应用程序在执行FetchRequest时崩溃
我不知道发生了什么,但它突然在 Visibility.m 实体类中的以下行崩溃。我没有对这些类进行任何更改,并且它曾经完美地工作。唯一的问题是我错误地删除了模型。我已从备份中恢复它并将其再次添加到项目中。
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];
。当失败时,它不会在控制台中显示任何错误,也不会显示任何其他提示。它跳转到 main 中的这一行
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 0x33210c1d 0x33210ad8)
terminate called throwing an exception[Switching to process 7171 thread 0x1c03]
[Switching to process 7171 thread 0x1c03]
但密钥路径在那里...我认为存在一些损坏...我该如何解决这个问题?
I don't know what happened but it suddenly crashes on the following line in the Visibility.m Entity class. I did not change anything on these classes and it used to work perfectly. Only thing is that I deleted the model by mistake. I have restored it from backup and added it again to the project.
vis = [[context executeFetchRequest:request error:&error] lastObject];
This are the few lines around it
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];
When failing it does not show any errors in console nor any other hints. It jumps to this line in main
int retVal = UIApplicationMain(argc, argv, nil, nil);
That is all...
any hints on how I could improve debugging or so? I have also tried to delete the app in the simulator but that did not workout as well.
AAH Finally I got an error message
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 0x33210c1d 0x33210ad8)
terminate called throwing an exception[Switching to process 7171 thread 0x1c03]
[Switching to process 7171 thread 0x1c03]
But the keypath is there... I think there is some corruption... how can I solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的模型中缺少 visID。看起来我从备份中获取了旧版本
visID was missing in my model. Looks like I took an older version from backup