Starting an answer to update while we work through this.
causing app to crash while migrating, is not a memory crash. That is a watch dog crash.
Migrating large Core Data database crash has no crash log but I suspect it is probably a watchdog as well.
Core Data lightweight migration crash is a watchdog crash as well, not a memory crash.
Once we see your crash we can see what is going on.
Update 1
Ok, 0x8badf00d
is our watch dog crash. This means your app is taking too long to launch.
How to fix this?
Don't stand up the core data stack in -applicationDidFinishLaunching...
is the short answer.
A quick fix is to have the initial view of your app be identical to the launch image (i.e. splash screen). Then when you launch it finishes -applicationDidFinish...
quickly (very quickly) and you can take as long as you want to migrate.
My recommendation (since you don't know how long the migration is going to take is to kick off is to:
- Check to see if a migration is necessary with
-[NSManagedObjectModel isConfiguration: compatibleWithStoreMetadata:]
- Update the view display to let the user know that a migration is occurring
- Do the migration in a background block (put the
-addPersistentStore...
in a block and call it on a background queue, it is thread safe although it is best to put locks around it). - Remove the temporary view when the migration is complete
- Launch your real UI.
That should be easy enough to change and gets you past the watchdog.