Search code examples
iphonefiledirectory-structurefile-sharing

iPhone Documents directory and UIFileSharingEnabled, hiding certain documents


I want the user to be able to access the files in the documents directory but am using core data and dont want the user to be able to access the store (the sqllite db), can i hide it from the user while still allowing file sharing, or can i put it in another directory where it will still get backed up?


Solution

  • The answer given by FrenchKiss Dev is not correct. The user will still be able to see the ".data" directory in iTunes and save that locally with all the files inside it.

    Instead, store private documents in Library/Preferences

    According to Apple:

    In addition to the directories documented previously, the entire /Library directory has always been preserved during updates and backups, except for /Library/Caches. Because of this, applications can create their own directories in /Library/ and those directories will be preserved in backups and across updates. To minimize the risk of name collisions, we recommend that you name this directory carefully. For example, a directory named Private Documents would be a good choice. You should store any files you don't want to share to Library/Preferences.