iOS CoreData应用升级需要注意的地方

来源:互联网 发布:淘宝网电脑网页版登录 编辑:程序博客网 时间:2024/06/04 17:35

如果你的app运用了CoreData技术,那么在你修改了DB字段以后,再在旧版本上升级为新版本时会crash. 因为升级只升级了应用app,没有升级目录下的db文件。如果是开发当中,只需要deleate app再install一次。如果是上传到appstore的软件,那你可要小心处理了,没有经过migrate处理的app,用户升级后必然会crash.

所需要的技术就是CoreData versioning and migrate.

http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/CoreDataVersioning/Articles/vmLightweight.html

http://iphonedevelopment.blogspot.com/2009/09/core-data-migration-problems.html

http://mobile.tutsplus.com/tutorials/iphone/core-data_schema-versioning-and-lightweight-migrations/


Lightweight Migrate 只支持轻量级的db修改,如:insert/update/delete 属性,表,  如果是更复杂的数据迁移,如某个属性*30%迁移到新model,则需要mapping model

原创粉丝点击