I haven't had to do this myself, but I don't see why you couldn't create a property list containing the data you need inserted and perform the 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 the version last run is the same as the current version. */ if (! previousVersion isEqualToString:currentVersion) { NSArray *versionList = applicationData objectForKey:@"Versions"; BOOL process = (nil == previousVersion); for (NSDictionary *versionData in versionList) { NSString *version = versionData objectForKey:@"version"; if (process) { // Send dictionary for this version update to some method to process it.. self processUpdate:versionData; } if (!process && version isEqualToString:previousVersion) process = YES; } } Idea being that the plist contains an array of dictionary describing each version of the application and the data that should updated for this version. The plist example I have below is lacking any required details so is just a stub to get the idea Also, no idea if the code actually works ;) Just how I think I might do it if I had to deal with the same thing, assuming I understand your issue correctly Should also note that with this you would want to update the previous version that is stored in user defaults on app launch after the data is updated so that it only 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"; } ); }.
I haven't had to do this myself, but I don't see why you couldn't create a property list containing the data you need inserted and perform the 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 the version last run is the same as the current version. */ if (! previousVersion isEqualToString:currentVersion) { NSArray *versionList = applicationData objectForKey:@"Versions"; BOOL process = (nil == previousVersion); for (NSDictionary *versionData in versionList) { NSString *version = versionData objectForKey:@"version"; if (process) { // Send dictionary for this version update to some method to process it.. self processUpdate:versionData; } if (!process && version isEqualToString:previousVersion) process = YES; } } Idea being that the plist contains an array of dictionary describing each version of the application and the data that should updated for this version.
The plist example I have below is lacking any required details so is just a stub to get the idea. Also, no idea if the code actually works ;) Just how I think I might do it if I had to deal with the same thing, assuming I understand your issue correctly. Should also note that with this you would want to update the previous version that is stored in user defaults on app launch after the data is updated so that it only 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"; } ); }.
Thanks Mike, this is not exactly matching my situation. I have a sqlite3 database used for persistence by CoreData in my app. The DB is ~4MB, and contains two sets of tables: one that holds user data, and one that holds application data.
The bulk of the DB is application data, and it is this that I need to be able to replace with a new set (without affecting the user data). – futureshocked Feb 11 at 9:37.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.