ios - Best practices to ensure Core Data can persist throughout development cycle -


i'm working on core data ios application. i've experienced few cases database has become out of sync model, due error (editing active xcdatamodel accident instead of creating new version). has resulted in loss of data beta-testers update bad version , experience app crashes. way know how recover these crashes delete , re-install app.

what best practices ensure beta-tester's data never lost again? doing following:

  • versioning xcdatamodel (editor->add model version)
  • enabled automigration:
nsdictionary *options = [nsdictionary dictionarywithobjectsandkeys:                              [nsnumber numberwithbool:yes], nsmigratepersistentstoresautomaticallyoption,                              [nsnumber numberwithbool:yes], nsinfermappingmodelautomaticallyoption, nil]; 

what other tips have been accrued more experienced core data developers? there way recover core data model out-of-sync cases?

creating new model version time change model is way avoid kind of problem. don't know of way xcode or other tools enforce on you. need make sure don't commit changes existing data model version. keep close eye on files changed before committing git (or whatever use).

the other thing need make sure test new build using same kind of upgrade beta users making. you're going along making changes , everything's ok, before pushing new build, start data similar beta testers use , upgrade new version. if there's issue of models not matching, you'll run it, , can fix before sending new build. simplest way to:

  1. remove app device
  2. install recent beta build , create data
  3. install new version , make sure upgrade works expected.

testing upgrade process critical new build of app, whether beta or release, can find upgrade problems before users do.


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -