Search code examples
iosxcodeipadcore-datansmanagedobjectcontext

Xcode 6 Beta crashes app using core data when run on iPad 7.1


A couple of days ago I updated to Xcode 6 Beta 5 and of course iOS 8 Beta SDK Beta 5. It runs one of my Core Data apps just fine on the simulator and my test devices running iOS 8. But then I tried to run the app on a physical iPad (4th Gen) running iOS 7.1 and it crashed with this error.

dyld`dyld_fatal_error:

0x2be730c4: trap
0x2be730c8: nop

So I tried to run it on an iPad Air 7.1 simulator and I didn't get the fatal error but I got the following console log after the app crashed.

'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request must have an entity.'

When I run the iPad Retina 7.1 Simulator - which should correspond to a 4th Gen iPad - it compiles and runs just fine! Also, it has no problem with any of the iPhones, simulated or not, running iOS 7.1! I never had any core data issues prior to beta 5.

I've cleaned the project, rebooted my Mac several times, and I still can't get it to run on my physical iPad or the iPad Air simulator on iOS 7.1.

I realize it could just be a really inconvenient bug, but I was wondering if maybe I was just overlooking something simple. I have a custom class that pulls from my core data entities and here is the code I use to call up the Managed Object Context:

#import "AppDelegate.h"

-(void) startContext {
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
self.context = [appDelegate managedObjectContext];
}

That's how I was showed to do it. Is that a bad way of loading the Managed Object Context for performing a fetch request? Is there a different way I should do it that maybe wouldn't cause these bugs?


Solution

  • Thanks Warren Burton. I feel kind of stupid. I thought I had deleted all instances of the app off of the simulators by using "Reset Content and Settings", but I guess I missed the iPad Air Simulator. I also forgot to delete it from the physical iPad. Once I deleted the two installs and re-built and ran, everything worked fine. So I guess my store files got corrupted when moving over to the new beta of iOS 8 SDK. It looks like the corruption only happened to installs on iOS 7, whereas iOS 8 installs made it through just fine.