Reputation: 101
As title,my app was worked well before opened sandbox,after that,it can't read any data.How can I get access for ~/Library and it's sub folders?
Upvotes: 1
Views: 1231
Reputation: 53000
The purpose of the sandbox is to prevent an application accessing files without the users explicit permission.
To get that permission you need to display a standard open dialog and request the user select the file or folder you wish to access. You can customise the dialog to make your intentions clear.
Once the user has selected the file/folder you can save a bookmark to it allowing your app to access it in future without asking for the user's permission each time.
This is quite a large topic and one you need to understand to write applications for Apple's sandboxed environment.
You can find details on how to do all of this in Apple's documentation; read up on the sandbox, bookmarks etc. SO and the Apple Dev Forums are also good places for information. If you get stuck once you have some code ask another question showing your code and explain your problem.
HTH
Upvotes: 4