Chris
Chris

Reputation: 3705

App crashes on executeFetchRequest

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?

Upvotes: 3

Views: 1436

Answers (1)

Chris
Chris

Reputation: 3705

visID was missing in my model. Looks like I took an older version from backup

Upvotes: 2

Related Questions