iPhone CoreData migration of data only -


i have iphone application uses coredata storage.

the persistent store (an sqlite3 database) shipped several of entities populated data. these data used create various menus , options in application. let's call these data "application data".

several other entities used application store user data.

although schema changes, need update application data provide new options users.

i have macruby script gets new data bunch of csv files , updates sqlite3 database on development machine, not sure best way update existing deployed apps new application data (remember, no schema change) without affecting user data.

any ideas?

_update_

after bit of thinking, getting oriented towards setting application download new sqlite3 file web server contains new data. once received, app copy data update sqlite3 file app's working database file, replacing application data, not touching user data.

a mechanism determining if update has been applied can use text file single database version number app download periodically. if number larger number of previous update (which stored locally), update proceed, otherwise ignore it.

if talking adding new entries sqlite3 store there reason couldn't on application launch? haven't had myself, don't see why couldn't create property list containing data need inserted , perform updates on application launch.

nsstring *applicationdatapath = [[nsbundle mainbundle] pathforresource:@"applicationdata" oftype:@"plist"]; nsstring *previousversion = [[nsuserdefaults standarduserdefaults] stringforkey:@"version"];  nsstring *currentversion = [[[nsbundle mainbundle] infodictionary] objectforkey:@"cfbundleversion"];  /* don't bother processing updates if version last run  same current version. */ if (! [previousversion isequaltostring:currentversion]) {    nsarray *versionlist = [applicationdata objectforkey:@"versions"];     bool process = (nil == previousversion);    (nsdictionary *versiondata in versionlist)    {      nsstring *version = [versiondata objectforkey:@"version"];      if (process)      {        // send dictionary version update method process it..        [self processupdate:versiondata];      }       if (!process && [version isequaltostring:previousversion])        process = yes;    } }     

idea being plist contains array of dictionary describing each version of application , data should updated version. plist example have below lacking required details stub idea.

also, no idea if code works ;) how think might if had deal same thing, assuming understand issue correctly.

should note want update previous version stored in user defaults on app launch after data updated runs once.

[{ versions = ( { data = { 1 = { entity = menu; }; }; version = "1.1"; }, { data = { 1 = { entity = menu; }; }; version = "1.2"; }, { data = { 1 = { entity = menu; }; }; version = "1.3"; }, { data = { 1 = { entity = menu; }; }; version = "2.0"; }, { data = { 1 = { entity = menu; }; }; version = "2.5"; } ); }]


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -