0

Few years ago, I wrote an app using Core Data in Objective-C. The file.sqlite was saved on folder Documents. I would like to write an update version but in swift language and I am care about the users don't loose their saved records. I saw that the new file.sqlite is saved on folder Application Support. I have 2 questions:

is it possible to save on the same folder that the users don't loose the records?

Or is it possible to copy the old file.sqlite to Application Support that the users can update the old records?

1 Answer 1

1

You can put the persistent store file in any directory that your app can write to. Core Data has no rules about where these files have to go. If you want to use the documents folder, just use the documents folder.

If you're using NSPersistentContainer, you can change the default location by using an instance of NSPersistentStoreDescription. If you're not using NSPersistentContainer, use a file URL that points to your desired location when you call addPersistentStoreWithType:configuration:URL:options:error:.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.