【发布时间】:2015-03-10 17:01:09
【问题描述】:
我使用 MagicalRecord 在我的项目中添加了 CoreData,但它在此方法上崩溃:
+(NSString *) MR_entityName {
NSString *entityName;
if ([self respondsToSelector:@selector(entityName)])
{
entityName = [self performSelector:@selector(entityName)];
}
if ([entityName length] == 0)
{
// Remove module prefix from Swift subclasses
entityName = [NSStringFromClass(self) componentsSeparatedByString:@"."].lastObject;
}
return entityName;
}
在第一个 if 中,在控制台中我的 entityName 为 nil。 有人可以帮我吗? @Edit:我添加了一些代码,这就是我现在在控制台中拥有的:
TestCoreData[483:6632] CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null) URL:file:///Users/macbookpro/Library/Developer/CoreSimulator/Devices/0E01E4C3-42E3-44A1-BE57-2A535715EE03/data/Containers/Data/Application/586065AE-FF44-4396-8999-9E06391595F6/Documents/ options:(null) ... returned error Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256.)" UserInfo=0x7be94450 {NSUnderlyingException=unable to open database file, NSSQLiteErrorDomain=14} with userInfo dictionary {
NSSQLiteErrorDomain = 14;
NSUnderlyingException = "unable to open database file";
}
【问题讨论】:
-
它给出什么类型的错误?
-
在右侧控制台中,您可以编写 print 或其他内容,但没有显示任何内容,但我在断点中有一个 Thread1 EXC_BAD_ACCESS,我什么也做不了,只需按下停止运行按钮。
-
访问不正确,我不知道为什么,如果从显示的方法开始,它会在第一时间发生。
-
添加异常断点并尝试找出代码崩溃的地方
标签: ios objective-c core-data magicalrecord