我正在关注将现有数据库预加载到核心数据中的教程。代码编译得很好,直到我到达这一行:
NSEntityDescription *entity = [NSEntityDescription insertNewObjectForEntityForName:@"FailedBankInfo" inManagedObjectContext:context];
它返回以下错误:2012-11-19 12:45:02.247 CoreDatTutorial2[2049:403] -[FailedBankInfo subentitiesByName]: unrecognized selector sent to instance 0x100301010'
我已经检查以确保它不为空并且它已保存到产品目录中。知道我做错了什么吗?如果我注释掉那行代码,项目编译没有问题。
这是其余的代码:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription insertNewObjectForEntityForName:@"FailedBankInfo" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
for (FailedBankInfo *info in fetchedObjects){
{