我是CoreData的新手,刚开始使用RestKit。我正在尝试使用CoreData创建一个Restkit项目。但是我收到了这个运行时错误:
+ [NSManagedObject managedObjectContext]
中的断言失败任何想法,我做错了什么?
以下是我的代码到目前为止。到目前为止,我还没有创建数据模型。
_objectManager = [RKObjectManager objectManagerWithBaseURL:@"https://api.foursquare.com/v2/venues"];
// _objectManager.objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"jiffAssignment.sqlite"];
RKManagedObjectMapping *locationMapping = [RKManagedObjectMapping mappingForClass:[Location class]];
[locationMapping mapKeyPath:@"address" toAttribute:@"address"];
[locationMapping mapKeyPath:@"crossStreet" toAttribute:@"crossStreet"];
[locationMapping mapKeyPath:@"city" toAttribute:@"city"];
[locationMapping mapKeyPath:@"state" toAttribute:@"state"];
[_objectManager.mappingProvider setMapping:locationMapping forKeyPath:@"location"];
// RKObjectMapping *statisticsMapping = [RKManagedObjectMapping mappingForClass:[Statistics class]];
// [statisticsMapping mapAttributes:@"checkinsCount",@"usersCount", nil];
NSLog(@"VenueListController Initialized");
return self;
任何帮助/评论都将不胜感激。
由于 维克
答案 0 :(得分:0)
您可以使用失败的实际断言来更新您的帖子吗?
如果RKManagedObjectMapping
没有设置_objectManager
,则您无法使用objectStore
。此行已在您发布的代码中注释掉。