Alexandre Odet
Alexandre Odet

Reputation: 75

Where should I save files

I've a question, not about code, but about a good practice. I've searched on Google but I didn't find anything. In my app (iOS) I have the possibility to download a file, but I don't know where I have to store it, for now I put it in the Documents folder, but I'm pretty sure that it's not its place. If you have the answer, or a link that could explain where I have to store it, it could be helpful. Thanks !

Upvotes: 1

Views: 105

Answers (2)

Saran
Saran

Reputation: 404

dont use temp directory to store data.then the path will unknown to user.save it on documents directory using the function called savetophotoalbum in IOS. it will save the datas on the Photos and also only limited space is allocated to an IOS app on your phone.it will last to crash in the future when you try to store lot of data on temp directory

Upvotes: -1

Eiko
Eiko

Reputation: 25632

Apple has a strong opinion about that: https://developer.apple.com/icloud/documentation/data-storage/index.html

In short:

  • documents and user generated data -> Documents directory
  • downloaded and/or easily to regenerate -> Caches directory
  • temporary data -> tmp directory -

The location you use (and maybe properties you set) is important for how the backup works as well.

Upvotes: 3

Related Questions