2012-02-25 83 views
0

我是CoreData新手,刚开始使用RestKit。我正在尝试使用CoreData创建Restkit项目。但我收到此运行时错误:Restartit与CoreData崩溃

断言失败+ 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

你能更新失败的实际断言你的帖子?

如果_objectManager没有设置objectStore,那么您应该无法使用RKManagedObjectMapping。该行在您发布的代码中注释掉。