0

进行了一些搜索,但无法找到任何合适的答案。提前感谢您帮助我解决我可能微不足道的问题。

这是有问题的Json:

   {
   "User":{
      "UserEvents":[

      ],
      "Vendor":null,
      "UserId":7,
      "CreatedDate":"1900-01-01T00:00:00",
      "UserName":"jasondboland@gmail.com",
      "LoginCount":0,
      "LastLogin":null,
      "CurrentEventId":6,
      "Company":null,
      "FirstName":"Wedding Pro",
      "LastName":"Boland",
      "Gender":"female",
      "Country":null,
      "FacebookLink":null,
      "FacebookData":null,
      "PaymentToken":"",
      "BillingAddress":null,
      "ShippingAddress":null,
      "ShipToPreference":1,
      "ReferralId":null,
      "BulkLicenseUpgrade":false,
      "DisplayName":"Wedding Pro Boland",
      "ImpersonateUser":null,
      "VendorInd":false,
      "AvailableLicenses":0
   },
   "Theme":{
      "ThemeId":2,
      "Name":"Tropical Beach 1",
      "ThumbnailImage":"~/images/themes/tropical_beach_registry_t.jpg",
      "LargeImage":"~/images/themes/tropical_beach_registry.jpg",
      "Type":1,
      "AccessLevel":1,
      "StyleName":"tropic-beach",
      "ActiveInd":true
   },
   "RegistryItems":[

   ],
   "Organizers":[
      {
         "OrganizerId":11,
         "CreatedDate":"2013-04-25T20:35:40.687",
         "Address":null,
         "OrganizerType":1,
         "FirstName":"Jason",
         "LastName":"Boland",
         "Email":"jasondboland@gmail.com",
         "Phone":"7143922631",
         "FacebookId":null,
         "PrimaryAccountInd":true,
         "VerifiedInd":true,
         "ActiveInd":true
      },
      {
         "OrganizerId":12,
         "CreatedDate":"2013-04-25T20:35:40.75",
         "Address":null,
         "OrganizerType":0,
         "FirstName":"Ezzy",
         "LastName":"Castillo",
         "Email":null,
         "Phone":null,
         "FacebookId":null,
         "PrimaryAccountInd":false,
         "VerifiedInd":false,
         "ActiveInd":true
      }
   ],
   "Attendees":[

   ],
   "Schedules":[
      {
         "ScheduleId":11,
         "CreatedDate":"2013-04-25T20:35:40.763",
         "ScheduleType":2,
         "Name":"Reception",
         "Description":"Sea Cliff Country Club",
         "DateStart":"2013-06-22T16:00:00",
         "DateEnd":null,
         "Address":null,
         "ShowOnline":false,
         "ActiveInd":true
      },
      {
         "ScheduleId":12,
         "CreatedDate":"2013-04-25T20:35:40.763",
         "ScheduleType":1,
         "Name":"Ceremony",
         "Description":"Sea Cliff Country Club",
         "DateStart":"2013-06-22T15:30:00",
         "DateEnd":null,
         "Address":null,
         "ShowOnline":false,
         "ActiveInd":true
      }
   ],
   "EventImages":[
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/aff69cb6-930b-4982-86e0-143d43a91da9_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/62b9c7e3-9ef8-41aa-b008-40847eb2eb18_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/b7281259-793d-4a7e-a2c7-466e2748a049_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/37cecb6b-0819-4a5e-aa21-475dfdad28c3_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/8f51398e-2cdf-47d2-a9bb-4fc32698ec18_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/a0e5f5c5-43f1-40db-b6cb-893bdf8d318e_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/17edaee6-8bdb-4988-847c-8977779c9000_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/0d460b63-9b65-4078-9660-a066c5390957_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/63536715-01ad-473f-b213-ba46f2f8a7d0_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      },
      {
         "ImageID":"00000000-0000-0000-0000-000000000000",
         "Container":null,
         "ImageName":null,
         "ImageDesc":null,
         "ThumbURL":null,
         "MediumURL":null,
         "LargeURL":"https://jjcompanies.blob.core.windows.net/eventimages/91f0675a-5df1-4c68-ae1f-e7db0c322e33_l",
         "ImageType":0,
         "SortOrder":0.0,
         "UserEvents":null,
         "RegistryItems":null
      }
   ],
   "UserEventId":6,
   "CreatedDate":"2013-04-25T20:35:40.56",
   "EventType":0,
   "Name":"Jason Boland and Ezzy Castillo's Wedding",
   "Description":"We can't wait to start out our lives together with a once in a lifetime trip to the south pacific.",
   "Date":"2013-06-22T00:00:00",
   "PaymentType":1,
   "CurrencyType":1,
   "EventLevel":1,
   "RequestAddresses":true,
   "ReferralCode":null,
   "EventURL":"JasonAndEzzy",
   "PublishedInd":true,
   "PublishedDate":"2013-07-17T16:31:02.687",
   "GalleryPurchasedInd":true,
   "GalleryPurchasedDate":"2013-05-16T20:02:36.757",
   "RequirePasswordOnGallery":false,
   "EventPassword":"",
   "BudgetPurchasedInd":true,
   "BudgetPurchasedDate":"2013-05-16T20:02:36.757",
   "GuestlistPurchasedInd":true,
   "GuestlistPurchasedDate":"2013-05-16T20:02:36.757",
   "GuestListInfoRequestsSent":null,
   "GuestListInfoRequestsMessage":null,
   "SampleInd":false,
   "ActiveInd":true,
   "DaysUntilWedding":"-25.13:43:16.6650000",
   "PrimaryOrganizer":{
      "OrganizerId":11,
      "CreatedDate":"2013-04-25T20:35:40.687",
      "Address":null,
      "OrganizerType":1,
      "FirstName":"Jason",
      "LastName":"Boland",
      "Email":"jasondboland@gmail.com",
      "Phone":"7143922631",
      "FacebookId":null,
      "PrimaryAccountInd":true,
      "VerifiedInd":true,
      "ActiveInd":true
   },
   "CeremonySchedule":{
      "ScheduleId":12,
      "CreatedDate":"2013-04-25T20:35:40.763",
      "ScheduleType":1,
      "Name":"Ceremony",
      "Description":"Sea Cliff Country Club",
      "DateStart":"2013-06-22T15:30:00",
      "DateEnd":null,
      "Address":null,
      "ShowOnline":false,
      "ActiveInd":true
   },
   "ReceptionSchedule":{
      "ScheduleId":11,
      "CreatedDate":"2013-04-25T20:35:40.763",
      "ScheduleType":2,
      "Name":"Reception",
      "Description":"Sea Cliff Country Club",
      "DateStart":"2013-06-22T16:00:00",
      "DateEnd":null,
      "Address":null,
      "ShowOnline":false,
      "ActiveInd":true
   }
}

目的:

@interface RKImage : NSObject
@property (nonatomic, copy) NSString *LargeURL;
@property (nonatomic, copy) NSString *ImageID;
@end

尝试的代码:

RKObjectMapping* wMapping = [RKObjectMapping mappingForClass:[RKImage class]];
    [wMapping addAttributeMappingsFromDictionary:@{
     //@"ImageID": @"ImageID",
     @"LargeURL": @"LargeURL"
     }];

    RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:wMapping pathPattern:nil keyPath:@"EventImages" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

    NSURL *URL = [NSURL URLWithString:@"http://myurl.cloudapp.net/api/mobilegallery/1"];
    NSURLRequest *request = [NSURLRequest requestWithURL:URL];
    RKObjectRequestOperation *objectRequestOperation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[ responseDescriptor ]];
    [objectRequestOperation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
        RKLogInfo(@"Load collection of Articles: %@", mappingResult.array);
    } failure:^(RKObjectRequestOperation *operation, NSError *error) {
        RKLogError(@"Operation failed with error: %@", error);
    }];

    [objectRequestOperation start];

我收到错误:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<RKImage 0xa25b240> valueForUndefinedKey:]: this class is not key value coding-compliant for the key LargeURL.'

编辑:启用日志记录时出错

2013-07-17 16:04:43.168 SimplyTieGallery[1002:c07] 我 restkit.network:RKObjectRequestOperation.m:174 GET ' http://4451cfc5be9c49f4896a2dd6eeec96c9.cloudapp.net/api/mobilegallery/1' 2013-07-17 16:04:44.927 SimplyTieGallery[1002:4103] D restkit.object_mapping:RKMapperOperation.m:390 为表示执行映射操作:{ ActiveInd = 1; 参加者 = ( ); BudgetPurchasedDate = ""; BudgetPurchasedInd = 0; CeremonySchedule = { ActiveInd = 1; 地址 = ""; CreatedDate = "2013-04-11T13:11:16.803"; 日期结束 = "2013-10-08T13:11:16"; 日期开始 = "2013-10-08T13:11:16"; 描述 = “福尔柯克庄园和乡村俱乐部”;名称 = 仪式;ScheduleId = 2; 计划类型 = 1;在线显示 = 1; }; CreatedDate = "2013-04-11T13:11:13.93"; 货币类型 = 1;日期 = "2013-10-08T00:00:00"; DaysUntilWedding = "82.00:55:14.3863200"; Description = “我们很快就会成为琼斯先生和琼斯女士,等不及了!当每个人都从盛大的派对(我们的婚礼)中恢复过来时,我们将登上飞往波拉波拉岛的飞机,以盛大的方式开始我们的生活!我们很幸运有一个储备充足的家,所以我们决定使用 SimplyTie 来帮助我们创造我们能想到的最美妙的蜜月。我们非常感谢大家的爱、支持和慷慨!非常感谢很多!约翰和朱迪·琼斯”;EventImages = ( { Container = ""; ImageDesc = ""; ImageID = "00000000-0000-0000-0000-000000000000"; ImageName = ""; ImageType = 0;https://jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l "; MediumURL = ""; RegistryItems = ""; SortOrder = 0; ThumbURL = ""; UserEvents = "" ; }, { Container = ""; ImageDesc = ""; ImageID = "00000000-0000-0000-0000-000000000000"; ImageName = ""; ImageType = 0; LargeURL = " https://jjcompanies.blob.core. windows.net/eventimages/cd22c262-8cbc-480b-b0ee-a4b33e248b70_l电子邮件 = "JudyMcGride@SimplyTie.com"; FacebookId = ""; 名字 = 朱迪;姓氏 = 麦克布赖德;组织者 ID = 1;组织者类型 = 0; 电话 = ""; PrimaryAccountInd = 1; VerifiedInd = 1; }, { ActiveInd = 1; 地址 = ""; CreatedDate = "2013-04-11T13:11:16.323"; 电子邮件 = "JohnJones@SimplyTie.com"; FacebookId = ""; 名字 = 约翰;姓氏 = 琼斯;组织者 ID = 2; 组织者类型 = 1;电话 = ""; PrimaryAccountInd = 0; VerifiedInd = 1; }); 支付类型 = 1; PrimaryOrganizer = { ActiveInd = 1; 地址 = ""; CreatedDate = "2013-04-11T13:11:16.32"; 电子邮件 = "JudyMcGride@SimplyTie.com"; FacebookId = ""; 名字 = 朱迪;姓氏 = 麦克布赖德;组织者 ID = 1;组织者类型 = 0; 电话 = ""; PrimaryAccountInd = 1; VerifiedInd = 1; }; PublishedDate = "2013-04-11T13:11:13.93"; PublishedInd = 1; ReceptionSchedule = { ActiveInd = 1; 地址 = ""; CreatedDate = "2013-04-11T13:11:16.803"; 日期结束 = "2013-10-08T13:11:16"; 日期开始 = "2013-10-08T13:11:16"; 说明 = " { ActiveInd = 1; 地址 = ""; CreatedDate = "2013-04-11T13:11:16.803"; 日期结束 = "2013-10-08T13:11:16"; 日期开始 = "2013-10-08T13:11:16"; 描述 = “福尔柯克庄园和乡村俱乐部”;名称 = 仪式;ScheduleId = 2; 计划类型 = 1;在线显示 = 1; }); 主题 = { AccessLevel = 1; ActiveInd = 1; LargeImage = "~/images/themes/tropical_beach_registry.jpg"; 名称=“热带​​海滩1”;StyleName = "热带海滩"; 主题 ID = 2; ThumbnailImage = "~/images/themes/tropical_beach_registry_t.jpg"; 类型 = 1;}; 用户 = { 可用许可证 = 0; 帐单地址 = ""; 批量许可证升级 = 0;公司 = ""; 国家 = ""; CreatedDate = "1900-01-01T00:00:00"; 当前事件 ID = 1; DisplayName = "约翰样品"; 脸书数据 = ""; FacebookLink = ""; 名字 = 约翰;性别 = 男性;模拟用户 = ""; 最后登录 = ""; 姓氏 = 样本;登录计数 = 0;支付令牌 = ""; 推荐人 ID = ""; ShipToPreference = 2; 运输地址 = ""; 用户事件 = ( ); 用户 ID = 1;用户名 = "boraborasample@simplytie.com"; 供应商 = ""; VendorInd = 0; }; 用户事件 ID = 1;} 和 targetObject: (null) 2013-07-17 16:04:44.930 SimplyTieGallery[1002:4103] T restkit.object_mapping:RKMapperOperation.m:333 检查 keyPath 'EventImages' 的可映射内容... 2013-07-17 16 :04:44.930 SimplyTieGallery[1002:4103] D restkit.object_mapping:RKMapperOperation.m:310 在 keyPath 'EventImages' 找到可映射的集合: ( { Container = ""; ImageDesc = ""; ImageID = "00000000-0000-0000- 0000-000000000000"; ImageName = ""; ImageType = 0; LargeURL = " VendorInd = 0; }; 用户事件 ID = 1;} 和 targetObject: (null) 2013-07-17 16:04:44.930 SimplyTieGallery[1002:4103] T restkit.object_mapping:RKMapperOperation.m:333 检查 keyPath 'EventImages' 的可映射内容... 2013-07-17 16 :04:44.930 SimplyTieGallery[1002:4103] D restkit.object_mapping:RKMapperOperation.m:310 在 keyPath 'EventImages' 找到可映射的集合: ( { Container = ""; ImageDesc = ""; ImageID = "00000000-0000-0000- 0000-000000000000"; ImageName = ""; ImageType = 0; LargeURL = " VendorInd = 0; }; 用户事件 ID = 1;} 和 targetObject: (null) 2013-07-17 16:04:44.930 SimplyTieGallery[1002:4103] T restkit.object_mapping:RKMapperOperation.m:333 检查 keyPath 'EventImages' 的可映射内容... 2013-07-17 16 :04:44.930 SimplyTieGallery[1002:4103] D restkit.object_mapping:RKMapperOperation.m:310 在 keyPath 'EventImages' 找到可映射的集合: ( { Container = ""; ImageDesc = ""; ImageID = "00000000-0000-0000- 0000-000000000000"; ImageName = ""; ImageType = 0; LargeURL = " 图像类型 = 0; 大网址 = " 图像类型 = 0; 大网址 = "https://jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l "; MediumURL = ""; RegistryItems = ""; SortOrder = 0; ThumbURL = ""; UserEvents = "" ; }, { Container = ""; ImageDesc = ""; ImageID = "00000000-0000-0000-0000-000000000000"; ImageName = ""; ImageType = 0; LargeURL = " https://jjcompanies.blob.core. windows.net/eventimages/cd22c262-8cbc-480b-b0ee-a4b33e248b70_l"; MediumURL = ""; RegistryItems = ""; SortOrder = 0; ThumbURL = ""; UserEvents = ""; }) 2013-07-17 16:04:44.931 SimplyTieGallery[1002:4103] D restkit.object_mapping:RKMapperOperation .m:244 要求映射源对象 { Container = ""; ImageDesc = ""; ImageID = "00000000-0000-0000-0000-000000000000"; ImageName = ""; ImageType = 0; LargeURL = " https:// jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l"; MediumURL = ""; RegistryItems = ""; SortOrder = 0; ThumbURL = ""; UserEvents = ""; } 映射 LargeURL>" )> 2013-07-17 16:04:44.931 SimplyTieGallery[1002:4103] D restkit.object_mapping:RKMappingOperation.m:912 开始映射操作... 2013-07-17 16:04:44.932 SimplyTieGallery[1002:4103] T restkit.object_mapping:RKMappingOperation.m:913 执行映射操作: for 'RKImage'目的。从对象映射值 { Container = ""; 图像描述 = ""; ImageID = "00000000-0000-0000-0000-000000000000"; 图像名称 = ""; 图像类型 = 0; LargeURL = " https://jjcompanies.blob.core.windows.net/eventimages/c4d56b3d-840e-4093-bdc8-8369cf05da34_l"; MediumURL = ""; RegistryItems = ""; SortOrder = 0; ThumbURL = ""; UserEvents = ""; } 到对象与对象映射 (null) 2013-07-17 16:04:44.932 SimplyTieGallery[1002:4103 ] T restkit.object_mapping:RKMappingOperation.m:515 映射属性值 keyPath 'LargeURL' 到 'LargeURL' 2013-07-17 16:04:44.933 SimplyTieGallery[1002:1703] D restkit.object_mapping:RKPropertyInspector.m:126 缓存属性检查类'RKImage':{ ImageID = { isPrimitive = 0; keyValueCodingClass = NSString; name = ImageID; }; LargeURL = { isPrimitive = 0; keyValueCodingClass = NSString; name = LargeURL; }; } 2013-07-17 16: 04:44.933 SimplyTieGallery[1002:4103]* 由于未捕获的异常“NSUnknownKeyException”而终止应用程序,原因:“[valueForUndefinedKey:]:此类与键 LargeURL 的键值编码不兼容。” * First throw call stack: (0x1e68012 0x1c8de7e 0x1ef0fb1 0x1962d1d 0x18cf00b 0x18cefbd 0x18ed247 0xa3561​​ 0xa4a92 0xa5e39 0xad45d 0x18ef453 0x18ef164 0x9bb79 0x9b018 0x1e61e7c 0x1e61a16 0x1e61925 0x9accb 0x9cbff 0x9d657 0x9e021 0x18ef453 0x18ef164 0x8c850 0x8a955 0x18ef453 0x18ef164 0x197ba31 0x254b53f 0x255d014 0x254e2e8 0x254e450 0x91453e72 0x9143bd2a) libc++abi.dylib:终止称为抛出异常(lldb)

尝试弄乱 keyPaths ,我只是无处可去。谢谢!

4

0 回答 0