DB updation when app new version comes ?



DB updation when app new version comes ?..

Answer / Hansraj Meena

In iOS, when a new version of an application is released, the existing database is not updated automatically. To update the database, you need to migrate the data from the old schema to the new one. This can be done using Core Data's NSMigratePersistentStoresToNewVersion method or by manually managing the SQLite databases if you are using SQLite as your database.nnHere is a simple example of how you might use NSMigratePersistentStoresToNewVersion:n```swiftnlet migrate = NSMigratePersistentStoresToURL(store: persistentStoreCoordinator.persistentStoreUrls.first!, toDestinationURL: destinationURL, options: migrationOptions, withCompletionHandler: { success, error inn if let error = error {n print("Migration Failed: (error)")n } else if success == true {n print("Migration Successful.")n }n })```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Apple iOS Interview Questions

Which api would you use to write test scripts to exercise the application’s ui elements?

1 Answers  


Enlist the latest ios development patform?

1 Answers  


What is nspersistentstore?

1 Answers  


Explain Apple push notification

1 Answers  


Are the nsmanagedobjectcontext queues serial or concurrent?

1 Answers  


What are the important delegate methods of nsxml parser?

1 Answers  


What is a delegate xcode?

1 Answers  


In a single model, can I have few entities in one sqlite db file and remaining in another sqlite db file?

0 Answers  


How do I open a csv file on my phone?

1 Answers  


Flow of push notification?

1 Answers  


. Name the framework that is used to construct application’s user interface for iOS. 

1 Answers  


Which json framework is supported by ios? : IOS Architect

1 Answers  


Categories