Memory issues migrating large CoreData datastores on iPhone

前端 未结 1 1514
温柔的废话
温柔的废话 2021-01-14 23:03

My app has a potentially very large CoreData datastore underneath it (could easily be upwards of 30MB). I\'ve started noticing memory issues when using the automatic migrat

相关标签:
1条回答
  • 2021-01-14 23:52

    I was able to get around this in the short-term by leveraging "lightweight" migration, as described in http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmLightweight.html#//apple_ref/doc/uid/TP40008426-DontLinkElementID_1.

    The trick is to pull the NSMigrationManager subclass that is specifically for SQLite store types when you're manually invoking the migration, as shown in the last code sample on that page.

    This isn't a general-purpose fix though since it only works if the schema change in your datastore is simple enough that lightweight migration is possible. Still waiting to hear back from Apple as to what the recommended solution is when you're dealing with a non-trivial mapping.

    0 讨论(0)
提交回复
热议问题