James
James

Reputation: 1689

iOS Core Data Migration happens on every app launch

I have a migration that is going to a new model where I'm indexing a couple of fields.

In order for it pickup the change, I also changed the version Hash. Now when the app starts it duly created the appropriate indexes and things work fast.

The problem is this is happening on every single launch. Shouldn't this happen just once?

Upvotes: 0

Views: 99

Answers (1)

steve_sch
steve_sch

Reputation: 656

I think the issue is that applicationWillTerminate only gets called when your app is terminated from the background. Maybe set a breakpoint to verify it's getting called, and consider moving it to applicationWillResignActive instead.

Upvotes: 1

Related Questions