How to allow permission for user's Home folder in cocoa application for mac

依然范特西╮ 提交于 2019-12-06 08:11:10
Michael Dautermann

I spent some time researching this and I can say that if you want an easy solution for being able to access files outside your app's sandbox, it's just not going to be possible.

And even if you were willing to work on a tougher, more technical solution, it is still likely to not be possible.

You should look at this section in the Apple's App Sandbox Design Guide entitled "Accessing User Data", specifically this bit:

If your app requires access to the user’s home directory in order to function, let Apple know about your needs using the Apple bug reporting system. In addition, be sure to follow the guidance regarding entitlements provided on the iTunes Connect website.

The next paragraph says the same thing about other app's preferences. Since you're trying to manipulate -- or delete -- other app's files, you're going to have to ask Apple for permission and/or guidance to do this.

If this were my problem, the only workaround I might possibly attempt would be to come up with might involve Security-Scoped Bookmarks and Persistent Resource Access, but as you can see from the linked documentation, it's not trivial to setup.

Summed up: if you want your app to remain sandboxed, you may need to rethink what you are trying to accomplish.

More information can be found in this related question.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!