I am migrating data from one model version to another in the iPhone, but the migration causes the device to run out of memory and crash. Not to mention it takes forever on the device. I use the default migration settings.
I guess the bad guy is one of the tables that contain the order of 105 rows. This table has not changed though, but the migration still generates operations for it (probably becaus开发者_如何学运维e of relations to other tables).
Any ideas what i can do to improve things? Of course, I could whip something up manually, but I really want to take advantage of as much as possible of the Core Data goodies.
You're most likely creating a large number of objects during the migration and not releasing them. You need to loop through the migration taking small nibbles and freeing up the memory used in each nibble before taking the next one.
See the Core Data Model Versioning and Data Migration Programming Guide: Multiple Passes—Dealing With Large Datasets
精彩评论