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

Accepted Reply

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.

  • Thank you so much for your help! I've done a bit of research and I think I understand it all now! Correct me if I'm wrong, but I've learnt that theres a Data Container within the App's sandbox which holds, among other things, a Library directory. This Library directory has a cache section and an Application Support section, and the Application Support section gives the App the ability to mark certain files for iCloud or iTunes backups. Great to know! Thanks a ton for your help!

Add a Comment

Replies

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.

  • Thank you for your response! I read that in a reply to a question posted on Stack Overflow. It was the answer to the question with the most votes so I figured it was correct, however I just noticed that all the other answers mentioned that that particular answer was wrong 😂. So would I need to store that .CVS file in the documents directory? Or can I keep it in the folder with the rest of the App's utilities? Sorry if this is a simple question, this is my first app. Thanks!

Add a Comment

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.

  • Thank you so much for your help! I've done a bit of research and I think I understand it all now! Correct me if I'm wrong, but I've learnt that theres a Data Container within the App's sandbox which holds, among other things, a Library directory. This Library directory has a cache section and an Application Support section, and the Application Support section gives the App the ability to mark certain files for iCloud or iTunes backups. Great to know! Thanks a ton for your help!

Add a Comment