Answer the question
In order to leave comments, you need to log in
iOS data migration when app version is updated?
General picture:
transition from version 1 of the application to version 2
With Core Data, everything is clear and everywhere a lot of things are written how to transfer it and how to migrate to version 2.
please answer point by point
1) Are userdefaults erased when updating or not?
2) .plist is erased on update or not?
3) Based on the second question, if our .plist is not erased, then how is it updated? (what will happen to what we programmatically added there in the old version? how to add new fields from the new one if the old one exists?)
4) How can any data be saved so that it does not disappear when updating? (I read that there are sort of folders from which they are transferred) and how do they behave when updating if the default file has been changed, how does this mechanism work?
5) if I'm right in question 4, then how to put it in Xcode so that it would be immediately saved to the right directory
6) how does the keychain behave when updating?
I just want to deal with this so that I don’t have to redo it later
and what you can read about general data migration between versions, not specifically coredate
Answer the question
In order to leave comments, you need to log in
1) userdefaults are erased when updating or not? - NO
2) .plist is erased on update or not? - WILL BE UPDATED
3) Based on the second question, .... - ----
4) How can any data be saved so that it does not disappear when updating? - DATA can be different - an event execution flag, a small set of data (name, phone number, etc.), files. Everyone has their own strategy. There is such storage that is not cleared even after deleting the application.
5) if I'm right in question 4, then how to put it in Xcode so that it would be immediately saved to the right directory - NOTHING IS DONE ITSELF, you need to manually compose the path that you need.
6) how does the keychain behave when updating? - REMAINS
UserDefaults remains . You will lose only if you replace the group, and then conditionally - when you connect to the group, access will return.
Plist is a file, replace it - you have a new file. Plist remains up to date for the version.
Additionally, files can be stored in the DocumentDirectory . For example, the Realm database file is there. To manage files there is a singleton FileManager , the basic principle of working on paths.
Records from Keychain do not disappear, but are you sure you want to store files there?
You brought different systems for different tasks. It's silly to store settings in Keychain and passwords in UserDefaults . Study each system separately. Universal"this is good, the rest is garbage " no.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question