Where to store files downloaded by application?
my iPhone application downloads image files from server and displays in image view. i have stored these files in tmp directory (i.e NSTemporaryDirectory()). I dont want, user can backup downloaded files or开发者_运维技巧 these cant be taken on Mac when he/she connects phone to mac. How should I assure this? Thank you, in advance.
Read A Few Important Application Directories and Getting Paths to Standard Application Directories
Store your images in the temp, caches, or application support directories depending on if you want them included in device backups and if you want those files to remain on the device when your application is terminated.
Nothing will stop a determined user from retrieving data from a device they control but you can easily make sure you don't expose those file through file sharing or unintentionally include them in device backups and I think that's the level of assurance you were looking for.
You can encrypt the file before storing, then decrypt to display. This won't stop the most determined users (since your key will probably be embedded in your app), but it will thwart all but the most resourceful.
精彩评论