【发布时间】:2012-02-25 21:23:01
【问题描述】:
我是 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;
任何帮助/cmets 将不胜感激。
谢谢 维克
【问题讨论】: