プロジェクトに追加するためのRestKitドキュメントのすべての手順に従いましたが、アプリを起動しようとすると、次の行で停止しますapplication:application didFinishLaunchingWithOptions:
:
entityMapping.identificationAttributes = @[@"_id"];
その前のコードは次のとおりです。
NSURL *modelURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"MyModel" ofType:@"momd"]];
NSManagedObjectModel *managedObjectModel = [[[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL] mutableCopy];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
// Init the Core Data stack
[managedObjectStore createPersistentStoreCoordinator];
NSPersistentStore __unused *persistentStore = [managedObjectStore addInMemoryPersistentStore:&error];
NSAssert(persistentStore, @"Faild to add persistent store: %@", error);
[managedObjectStore createManagedObjectContexts];
// Set the default shared store instance
[RKManagedObjectStore setDefaultStore:managedObjectStore];
// Configure the object manager
RKObjectManager *objectManager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://localhost:9090"]];
objectManager.managedObjectStore = managedObjectStore;
[RKObjectManager setSharedManager:objectManager];
RKEntityMapping *entityMapping = [RKEntityMapping mappingForEntityForName:@"Pool" inManagedObjectStore:managedObjectStore];
[entityMapping addAttributeMappingsFromDictionary:@{
@"id": @"_id",
@"about_url": @"aboutURL",
@"closed": @"closed",
@"created_on": @"createdOn"
}];
entityMapping.identificationAttributes = @[@"_id"];
if (!attribute) [NSException raise:NSInvalidArgumentException format:@"Invalid attribute '%@': no attribute was found for the given name in the '%@' entity.", attributeOrName, [entity name]];
の一部である行 100 ()の RKEntityMapping.m で例外がスローされRKArrayOfAttributesForEntityFromAttributesOrNames
ます。
「プール」と表示されていpo [entity name]
ても、.xcdatamodeld にプール エンティティがあります。
このエラーの原因を他にどこで探すことができますか?