0

JSONをエンティティにマッピングするのに問題があります。エラーメッセージは次のとおりです。マッピングエラーの追加:keyPathのオブジェクトマッピングが見つかりませんでした:''。私は次のコードを使用しています:

RKObjectMapping *lEgmMapping = [RKObjectMapping mappingForClass:[EGM 
class]]; 
    [lEgmMapping mapKeyPath:@"Id" toAttribute:@"Id"]; 
    [lEgmMapping mapKeyPath:@"InternalId" toAttribute:@"internalId"]; 
    [lEgmMapping mapKeyPath:@"PlayerType" toAttribute:@"playerType"]; 
    [lEgmMapping mapKeyPath:@"PositionX" toAttribute:@"x"]; 
    [lEgmMapping mapKeyPath:@"PositionY" toAttribute:@"y"]; 
    [lEgmMapping mapKeyPath:@"Size" toAttribute:@"size"]; 
    [lEgmMapping mapKeyPath:@"Status" toAttribute:@"status"]; 
    [[RKObjectManager sharedManager].mappingProvider 

    setMapping:lEgmMapping forKeyPath:@"GetEgmMarkersBySiteResult"]; 

そして、Webサービスから次のJSONを取得しています。

{"GetEgmMarkersBySiteResult":[{"Id": 
94,"InternalId":"A2345","PlayerType":"2","PositionX":686,"PositionY": 
1460,"Size":23,"Status":"0"},{"Id": 
83,"InternalId":"A1002a","PlayerType":"0","PositionX":1414,"PositionY": 
906,"Size":30,"Status":"0"},{"Id": 
81,"InternalId":"asd","PlayerType":"0","PositionX":1338,"PositionY": 
925,"Size":33,"Status":"0"}]} 

私は何が間違っているのですか?ありがとうございました。

編集:何が起こるかは、それがappdelegate applicationlaunchedwithoptionsにあるときにマッピングを見つけることができなかったということです。これは、バインディングをロードするのに適した場所だと思いました。バインディングをロードするのに適した場所はどこだと思いますか?別のビューコントローラが同じバインディングを定義している場合、ランタイムエラーが発生する可能性がありますか?

4

0 に答える 0