Is it possible to not overwrite certain files when updating (upgrading) an app on iOS?

Hello!

I'm in the process of creating an app for iOS. A part of the app relies on data that is collected as the user uses the app. This data is then stored in a .CSV file for easy storage, retrieval, and a small size even if it grows larger than expected.

The data is really simple and easy to traverse, however it won't be stored on a remote database, and only locally on the user's device. I've read that updating the app doesn't overwrite the data of the current version, but instead places the new version of the app in a new directory entirely while the other, older version is then deleted.

Is it possible to mark certain files to be transferred and not replaced entirely? I'd like to know if it's possible or not before I make the mistake and learn the hard way 😅

Also I'm open to any alternative ways to store such data that people may suggest!

Thanks a lot in advance! Help is much appreciated

Jack

Answered by endecotp in 773757022

I just noticed that all the other answers mentioned that that particular answer was wrong 😂.

Great!

So would I need to store that .CVS file in the documents directory?

By convention the Documents directory is for content that the users is directly aware of, e.g. their documents in a word processor or spreadsheet app. For other data which is not quite as literally a “document”, consider “Application Support”. Note: I think you need to create that directory if it doesn’t already exist. Search should find more info.

I've read that updating the app doesn't overwrite the data of the current version, but instead places the new version of the app in a new directory entirely while the other, older version is then deleted.

Where did you read that? You didn't ask Chat GPT, did you? Sounds like the sort of nonsense it would spout.

It's not true. When your updated app runs, it sees the files that the previous version wrote in the Documents/ directory and elsewhere.

Accepted Answer

I just noticed that all the other answers mentioned that that particular answer was wrong 😂.

Great!

So would I need to store that .CVS file in the documents directory?

By convention the Documents directory is for content that the users is directly aware of, e.g. their documents in a word processor or spreadsheet app. For other data which is not quite as literally a “document”, consider “Application Support”. Note: I think you need to create that directory if it doesn’t already exist. Search should find more info.

Is it possible to not overwrite certain files when updating (upgrading) an app on iOS?
 
 
Q