应用程序在executeFetchRequest上崩溃

问题描述:

我不知道发生了什么,但它突然崩溃在Visibility.m实体类的以下行。我没有改变这些类的任何东西,它曾经完美地工作。唯一的问题是我错误地删除了模型。我已经从备份中恢复它并将其重新添加到项目中。应用程序在executeFetchRequest上崩溃

vis = [[context executeFetchRequest:request error:&error] lastObject]; 

这是它周围的几行

NSFetchRequest *request = [[NSFetchRequest alloc] init]; 
    request.entity = [NSEntityDescription entityForName:@"Visibility" inManagedObjectContext:context]; 
request.predicate = [NSPredicate predicateWithFormat:@"visID = %@",[tmpDict objectForKey:@"visiID"]]; 

NSError *error = nil; 
vis = [[context executeFetchRequest:request error:&error] lastObject]; 

失败时它不显示在控制台中的任何错误,也没有任何其他线索。它跳转到该行主要

int retVal = UIApplicationMain(argc, argv, nil, nil); 

这是所有...

我如何能提高调试或使任何提示?我也尝试删除模拟器中的应用程序,但也没有解决问题。

AAH最后,我得到一个错误信息

Catchpoint 6 (exception thrown).2011-12-22 07:39:08.665 CaveConditions[14452:5b07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath visID not found in entity <NSSQLEntity Visibility id=9>' 
*** First throw call stack: 
(0x3446a8bf 0x346ba1e5 0x32f6d103 0x32f6cddf 0x32f6ca39 0x32f6c0fb 0x32f6bb93 0x32f6b031 0x32f697f5 0x6b13 0x62a1 0x107d1 0x4293 0x343c9803 0x53b99 0x541b1 0x343c922b 0x4df85 0x35dc0a91 0x35e545a1 0xc1d 0xad8) 
terminate called throwing an exception[Switching to process 7171 thread 0x1c03] 
[Switching to process 7171 thread 0x1c03] 

不过的keyPath是存在的......我认为有一些腐败现象...我怎样才能解决这个问题?

+0

当应用程序崩溃时,您在控制台中收到什么消息? – paulbailey 2011-12-21 21:20:47

+0

绝对没有。我添加了一个异常处理程序,它将停止在上述行。我就是这样。 – Chris 2011-12-21 22:02:42

+1

该属性可以在'Visibility'类中声明,但是您确定属性'visID'存在于模型的实体中吗? – 2011-12-22 20:21:18

我的模型中缺少visID。看起来像我从备份中获取旧版本