简体   繁体   中英

How to protect my application data in Documents directory

How can I protect files in my application "Documents" directory? Using iFunBox, or another application like it, anyone can to see, what application store in it's documents directory. So if I want to store some private data, or information about in-apps status, gold, achievments or something else just in .plist-files it will be not safelly. Maybe there is a best-practices for iOS application how to secure and protect their data?

It is not possible to truly secure data from the user. It is naturally secured from other applications, but the user is always able to get access to everything on-disk or in memory.

That said, if you have data that the user is not supposed to access, then you should not store it in Documents , since this is backed up via iTunes. You should store it in Library . See "The Library Directory Stores App-Specific Files" in the File System Programming Guide for details on each possible location and how it is treated by the system.

Applications you make for iOS are sandboxed, ie, the apps feel like they are the only thing on the system. As a result, they cannot access any place outside the app. You are restricted to using the Documents, Library folders which are visible to applications like iFunBox.

Your best bet is to hash out the data and then store them to files, so that if anyone tries to edit your files it results in a hash mismatch, that you can read in your application, and make your data secure.

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