开发者

iPhone database migration times out

开发者 https://www.devze.com 2022-12-20 14:37 出处:网络
I have an iphone app that allows you to download map tiles, which are stored in a core-data sqlite database. I\'d previously set up database migration using momd, following this guide - http://iphoned

I have an iphone app that allows you to download map tiles, which are stored in a core-data sqlite database. I'd previously set up database migration using momd, following this guide - http://iphonedevelopment.blogspot.com/2009/09/core-data-migration-problems.html

That all works perfect when testing upgrading, when I have small amounts of data in each table. But when I have a large map downloaded, 100 MB or so, the database migration times out, and the app doesn't launch within 10 seconds. The database is then corrupted, and only deleting the app and re-installing it will fix it.

My data model change affected the waypoint table, which is relatively small and just added a column, so it shouldn't have needed to do a large operation across the whole ma开发者_Python百科p tile table.

Is there a better way to handle data model changes?


In this case, you should be storing such large images as separate files in the Documents directory. Then, you would store the file name as a property in your Core Data entity.

In general, if you have an operation that is taking a lot of time at app launch, you should move it to a background thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消