开发者

iPhone database migration times out

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜