简体   繁体   中英

iOS acces temporary private files when iPhone is connected to a computer

I have an iOS app that is downloading a password protected PDF file. I use some code to unlock the PDF using a password, but I must save it to disk temporarily in order to present in in a view on the screen (I cannot present it only from having it in memory).

My question: Is that temporary file visible when connecting the device to a computer? Is there any private app namespace that makes app files invisible to the computer?

I noticed if I connect the iPhone to a Windows machine, I don't see any files except images.

See The File System Programming Guide for full details.

Files you want private to the app should be placed in ~/Library , in your case I would probably use ~/Library/Caches , since it is explicitly not backed-up and this seems to be cached information (ie you could download it again if needed). You could also use ~/tmp if this is really just a temporary file that could be safely deleted any time your app isn't running (you are still responsible for actually deleting these files).

Note that this is not a strong protection, since a jailbroken device can read and copy this data, but it does prevent it from showing up in file sharing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM