Note that there are some explanatory texts on larger screens.

plurals
  1. POBest way to manage iOS app and database updates
    primarykey
    data
    text
    <p>I'm developing an iOS app that makes use of an <code>sqlite</code> database directly, without using <code>Core Data</code>. I've the tables for the database defined in a file that I read to copy the database to <code>Documents</code> the first time I need it.</p> <p>I'm worrying about publishing app updates in the App Store once the app submitted when such updates have changes in database tables. I asked how to handle this database updates in another post, and I was told that the way to proceed is to upload an app version that removes the former database and copies the new one into <code>Documents</code> with another name. I do that, but I'm still not sure of what the appropriate way to manage this issue should be. I mean, I'm currently doing this way:</p> <pre><code>- (void)applicationDidBecomeActive:(UIApplication *)application { // Database NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([defaults boolForKey:@"firstLaunch"] == 0) { dispatch_queue_t queue = dispatch_queue_create(DatabaseQueue, NULL); dispatch_async(queue,^{ [self replaceDatabase:@"former_database.sqlite" withDatabase:@"new_database.sqlite"]; [self doDataInsertions]; [defaults setBool:1 forKey:@"firstLaunch"]; }); dispatch_release(queue); } } </code></pre> <p>But I don´t know if this will work when a user will download and install an update. When installing an update, are the values in <code>NSUserDefaults</code> kept? I suppose this scenario, managing database updates when updating app version in App Store, is a common one, so could somebody clarify me what the correct way to manage this is? I don't completely understand how the app updates submission thing work, this will be my first submission.</p> <p>Thanks so much </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload