Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS iTunes Filesharing Question

I have an app for iOS that uses Filesharing to provide the user with a couple of downloaded files. This works great, but there are a couple of files that I don't want the user to have access to.

Can I provide a custom folder where iTunes can get the data from or what can I do to prevent these files from being accessed?

like image 265
Pripyat Avatar asked Jun 11 '11 20:06

Pripyat


2 Answers

You can put the files you want to exclude from filesharing either in (a subfolder in) Library or Caches Folder. Library will be backuped with iTunes, Caches not.

like image 137
Felix Avatar answered Oct 20 '22 00:10

Felix


From Sharing Files with the User section from docs:

Important: In iTunes, users can manipulate only the top-level items in the Documents directory. Users cannot see the contents of subdirectories but can delete those directories or copy their contents to the desktop. Take this into consideration when deciding where to put files in this directory.

So with File sharing enabled you cannot hide files in Documents folder - you rather should put it in another folder in application sandbox:

If you do not want files to be shared with the user, put them in your application’s Library directory. If none of the standard Library subdirectories are appropriate, create a private directory inside the Library directory and give it the name of your application’s bundle ID. You can then use that directory to store any files that are private to your application.

like image 27
Vladimir Avatar answered Oct 19 '22 23:10

Vladimir