Search code examples
iosiphonensfilemanagercode-access-security

Is it possible to store all your iOS App data in Library/Preferences folder?


The concern here is more of security.

Recently I came across an app security issue:

I stored all my Database and downloaded PDF files in to App's Document Directory, but i realized that the content is vulnerable. If some X user get hand on ipa file and make changes to Info.plist "Application supports iTunes file sharing", set it to YES. And Resign the ipa, using his own developer certificate. He will be able to access all the data app is downloading to Document folder through iTunes. Though app has login but it can run in offline mode and App's Database is also copied to Document folder.

Solution I found:

Instead of downloading content to Documents folder, use Library/Preferences folder.

Question:

Does Apple allow this? Downloading content to Library/Preferences folder? Or any other better alternatives are there?


Solution

  • You can save your app data in a directory with name starting with a "." to hide it. For example ".MyAppData". These hidden folder shouldn't be visible in itunes file sync. I am not too sure if Directories can be made hidden using this technique but files certainly can be made hidden. I have used this method to hide my sqlite database in one of my app.