Iphone 使用restkit的coredata中的空值

Iphone 使用restkit的coredata中的空值,iphone,ios5,restkit,Iphone,Ios5,Restkit,我正在使用restkit处理核心数据,我有两个模型(Post和Photos)现在一个帖子有很多照片,我在帖子中有照片,它们映射到模型中,coredata中的条目已完成,但photo的值为null 帖子中有5张照片,这些记录被插入coredata中,但值为空 下面是映射代码 照片映射 - (RKManagedObjectMapping *)photosMapping { RKManagedObjectMapping *mappingPhoto = [RKManagedObjectMappin

我正在使用restkit处理核心数据,我有两个模型(Post和Photos)现在一个帖子有很多照片,我在帖子中有照片,它们映射到模型中,coredata中的条目已完成,但photo的值为null

帖子中有5张照片,这些记录被插入coredata中,但值为空

下面是映射代码

照片映射

- (RKManagedObjectMapping *)photosMapping {
   RKManagedObjectMapping *mappingPhoto = [RKManagedObjectMapping mappingForClass:[DBPhoto class] inManagedObjectStore:self.objectStore];
   mappingPhoto.setDefault``ValueForMissingAttributes = NO;
   mappingPhoto.primaryKeyAttribute = @"photoID";
   [mappingPhoto mapKeyPathsToAttributes:
    @"id", @"photoID",
    @"full_url", @"full_url",
    @"thumb_url", @"thumb_url",
    nil];
   return mappingPhoto;``
}


-
},


Post Mapping 

[mappingPost mapKeyPath:@"photos" toRelationship:@"photos" withMapping:[self photosMapping]];

The Json response for Post is 

"post": {
"id": 4,
"topic": "Post Meniscectomy Knee Pain",
"body": "<p>I&#39;ve got a healthy, active 60 yo woman with normal to low BMI who is s/p partial medial meniscectomy x 2 in the past 7 years (last was two years ago).&nbsp; She has relatively benign articular cartilage throughout the knee, including medially.</p><p>&nbsp;Her <u>medial joint line tenderness and pain</u> and really bothering her and she has a small Baker&#39;s cyst.&nbsp; Her MRI 1/2008 shows, not surprisingly, an irregular medial meniscus, possible tear/globular, small B cyst.</p><p>Her alignment is a couple degrees of physiologic varus bilaterally, nothing too impressive.</p><p>standing AP, 45 PA Xrays are more or less normal, other than symmetrical, slight narrowing in the medial compartment bilaterally.</p><p>She wants to get back to her daily walk and some limited cardio exercise activities.&nbsp; </p><p>I tried an unloader brace a year ago, and she was not very compliant with it. What options would you consider?&nbsp; She&#39;s obviously &#39;old&#39; for a meniscal allograft, and I don&#39;t know if her personality would tolerate it, but her cartilage was benign when I scoped her two years ago</p>",
"comments_count": 26,
"votes_count": 8,
"views_count": 1,
"created_at": "2008-06-03T04:40:00-03:00",
"updated_at": "2012-04-01T04:08:08-03:00",
"has_poll": true,
"has_photos": true,
"has_videos": true,
"has_documents": false,
"subspecialty": {
"id": 5
},-
"user": {
"id": 15
},-
"post_type": {
"id": 1
},-
"forum_type": {
"id": 1
},-
"tags": [(5)
{
"tag": {
"id": 50
}-
},-
{
"tag": {
"id": 51
}-
},-
{
"tag": {
"id": 52
}-
},-
{
"tag": {
"id": 53
}-
},-
{
"tag": {
"id": 54
}-
}-
],-
"": [(0)],
"poll": {
"id": 2,
"title": "Primary Treatment Options?",
"a1": "Medial Unloader Brace and live with it",
"a2": "Scope it, Meniscectomy then Unloader brace",
"a3": "Medial Unicompartmental Arthroplasty",
"a4": "Medial Meniscal Allograft",
"a5": "Total Knee Replacement"
},-
"photos": [(1)
{
"photo": {
"id": 2,
"full_url": "/uploads/photos/posts/4/2_9371a426ef.jpg",
"thumb_url": "/uploads/photos/posts/4/2_9371a426ef_thumb.jpg"
}-
}-
],-
"videos": [(1)
{
"video": {
"id": 133,
"full_url": "/images/fallback/videos/default.gif",
"thumb_url": "/images/fallback/videos/thumb_default.gif"
}-
}-
]-
}-
}
-(RKManagedObjectMapping*)PhotoMapping{
RKManagedObjectMapping*mappingPhoto=[RkmanagedObjectMappingForClass:[DBPhoto class]inManagedObjectStore:self.objectStore];
mappingPhoto.setDefault``ValueForMissingAttributes=NO;
mappingPhoto.primaryKeyAttribute=@“photoID”;
[mappingPhoto MapKeyPathStoAttribute:
@“id”@“photoID”,
@“完整url”@“完整url”,
@“拇指url”@“拇指url”,
零];
返回地图照片``
}
-
},
后映射
[mappingPost mapKeyPath:@“照片”与关系:@“照片”与映射:[自映射];
Post的Json响应是
“职务”:{
“id”:4,
“主题”:“半月板切除术后膝关节疼痛”,
“身体”:“I';我有一位健康、活跃的60岁女性,体重指数正常或较低,在过去7年(最后一次是两年前)进行了s/p内侧半月板部分切除术x2”.她的整个膝盖都有相对良性的关节软骨,包括内侧。

她的内侧关节线压痛和疼痛确实困扰着她,她有一个小的贝克囊肿。她的MRI 1/2008显示,毫不奇怪,内侧半月板不规则,可能有撕裂/球状,小的B囊肿。

她的排列是几度双侧生理内翻,没什么了不起的。

站在AP,45帕的X光片或多或少是正常的,除了对称的,双侧内侧隔室轻微狭窄。

她想恢复日常散步和一些有限的有氧运动。

一年前我试过一个减压支架,但她没有非常符合它。你会选择什么样的选择?她和Y 39是明显的,39岁;老的和39岁的;对于半月板同种异体移植,我不知道她是否能容忍它,但是她的软骨是良性的,当我在两年前对她进行观察时,

“评论数”:26, “计票”:8, “视图计数”:1, “创建时间”:“2008-06-03T04:40:00-03:00”, “更新时间”:“2012-04-01T04:08:08-03:00”, “has_poll”:对, “has_photos”:没错, “has_videos”:没错, “has_documents”:假, “副专业”:{ “id”:5 },- “用户”:{ “身份证”:15 },- “post_类型”:{ “id”:1 },- “论坛类型”:{ “id”:1 },- “标签”:[(5) { “标签”:{ “身份证”:50 }- },- { “标签”:{ “身份证”:51 }- },- { “标签”:{ “身份证”:52 }- },- { “标签”:{ “身份证”:53 }- },- { “标签”:{ “id”:54 }- }- ],- "": [(0)], “投票”:{ “id”:2, “标题”:“主要治疗方案?”, “a1”:“内侧卸粮器支架并与之配合使用”, “a2”:“范围it,半月板切除,然后卸船机支架”, “a3”:“内侧单室关节成形术”, “a4”:“同种异体内侧半月板移植”, “a5”:“全膝关节置换术” },- “照片”:[(1) { “照片”:{ “id”:2, “完整url”:“/上传/photos/posts/4/2_9371a426ef.jpg”, “thumb_url”:“/上传/photos/posts/4/2_9371a426ef_thumb.jpg” }- }- ],- “视频”:[(1) { “视频”:{ “id”:133, “完整url”:“/images/fallback/videos/default.gif”, “thumb_url”:“/images/fallback/videos/thumb_default.gif” }- }- ]- }- }
,强调文本

这是我访问照片模型时的响应

"<DBPhoto: 0x7daf4d0> (entity: DBPhoto; id: 0x7d9a5e0 <x-coredata://162D7572-B46F-4566-92E6-C07DA4ABEAD2/DBPhoto/p1> ; data: <fault>)",
   "<DBPhoto: 0x7dae460> (entity: DBPhoto; id: 0x7d9cfb0 <x-coredata://162D7572-B46F-4566-92E6-C07DA4ABEAD2/DBPhoto/p2> ; data: <fault>)",
   "<DBPhoto: 0x7da8ab0> (entity: DBPhoto; id: 0x7d9bd70 <x-coredata://162D7572-B46F-4566-92E6-C07DA4ABEAD2/DBPhoto/p3> ; data: <fault>)",
   "<DBPhoto: 0x7dad8f0> (entity: DBPhoto; id: 0x7da3040 <x-coredata://162D7572-B46F-4566-92E6-C07DA4ABEAD2/DBPhoto/p4> ; data: <fault>)",
   "<DBPhoto: 0x7daa240> (entity: DBPhoto; id: 0x7d92c10 <x-coredata://162D7572-B46F-4566-92E6-C07DA4ABEAD2/DBPhoto/p5> ; data: <fault>)"
“(实体:DBPhoto;id:0x7d9a5e0;数据:)”,
“(实体:DBPhoto;id:0x7D9Cf00;数据:)”,
“(实体:DBPhoto;id:0x7d9bd70;数据:)”,
“(实体:DBPhoto;id:0x7da3040;数据:)”,
“(实体:DBPhoto;id:0x7d92c10;数据:)”

但是这些条目是空的。它们位于数据库中

添加NSLog以查看核心数据中的数据。您显示的是故障,而不是没有数据,这是另一回事。你可能会发现数据就在那里。大概