开发者

iOS iTunes Filesharing Question

开发者 https://www.devze.com 2023-03-12 20:22 出处:网络
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.

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 开发者_StackOverflow中文版iTunes can get the data from or what can I do to prevent these files from being accessed?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消