0

私はオブジェクトを次のように休ませました:

@interface VFEQuestionnaireRest : NSObject
    @property(copy ,nonatomic) NSNumber *iid;
    @property(copy, nonatomic)NSString *namePoll;
    @property(copy, nonatomic)NSSet *questions;
@end

そして次のようなJSON:

    {"questionnaire":[
      {"id":4,"namePoll":"questionario4","questions":              
         {"id":13,"idQuestionnaire":4,"nameQuestion":"costo?",
            "questionType":{"id":2,"nameType":"WHOLE"}}}]}

値「iid」は常に「0」であり、namePoll には正しい値があります。JSONからNSNumberobjCにint値をマッピングするにはどうすればよいですか?

-

RKObjectMapping *questionnaireMapping = [RKObjectMapping mappingForClass:[VFEQuestionnaireRest class]];
    [questionnaireMapping addAttributeMappingsFromDictionary:
     @{@"iid":@"id",
    @"namePoll":@"namePoll"
     }];
[questionnaireMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"questions" toKeyPath:@"questions"  withMapping:questionMapping]];
4

1 に答える 1