Master data swallowing uncaught exception

I ran into a troublesome / incomprehensible error. Core Data seems to have swallowed its own exception! While using the (super-useful) CoreDataHelper, I wrote a poorly formed selection that resulted in an "Invalid SQL generation for predicate" exception. This part is simple, which is really strange that this exception was caught and swallowed somewhere, which means that my code just skipped the rest of the method after this fetch and returned to the main loop without any console messages. Pretty crazy.

In the end I managed to wrap the actual fetch request in the @try statement and @catch the exception:

@try{
fetchResults = [managedObjectContext executeFetchRequest:request error:&error];
    NSLog(@"fetch successful");
}
@catch (NSException* exception) {
    NSLog(@"caught exception!\n\n%@\n\n%@\n\n%@",[exception name], [exception reason], [exception userInfo]);
}

      

This allows me to understand what it was, but it still makes no sense that it will come across somewhere. I haven't used @ try / @ catch elsewhere in my code other than to test this.

I also tried to create an empty Core Data project and use CoreDataHelper without @ try / @ catch statement to try and isolate the problem without having anything else in the project, CoreDataHelper works as it should, returning:

CoreDataTest[1044:11603] *** Terminating app due to uncaught exception   'NSInvalidArgumentException', reason: 'Unimplemented SQL generation for predicate ("test" LIKE attribute)'

      

So, something in my project is catching and ignoring this exception, but it's not me if I can't somehow do it without using @catch.

What could it be?!

+3


source to share


1 answer


Got it!

I am using an external accessory (Linea Pro-4 barcode scanner / MSR) which has its own library and this is what caught the exception even in their newest version of the framework.



I set up my blank test project to connect to the accessory before running the same fetch request and bam! Swallows an exception!

+2


source







All Articles