Mac App Sandboxing- Updating files outside the sandbox

狂风中的少年 提交于 2019-12-11 12:02:08

问题


I have an Application for the Mac that I want to publish on in the app store. I order to get it published I need to put in a sandbox. The app access Sqlite files outside the sandbox which the user selects from a openpanel. The App works fine when is performs a select but it fails on inserts and updates. I can remember reading something about some function you could call that could give you write access to files outside the sandbox but for the life I can remember what is was Can anyone enlighten me ?

Regards Christian Arild Stœr Andersen


回答1:


Add "com.apple.security.files.bookmarks.app-scope" with boolean value YES in entitlement file of your project. Add follow "With Sandboxing" section of this link --

http://cocoaintheshell.com/2012/09/saving-sandboxing/

When you resolve your URL, by using URLByResolvingBookmarkData: method, you will get the url something like this --

file://localhost/Users/XYZ/Downloads/MyAudio.mp3?applesecurityscope=353734653735396237656239646134396537363331633063393765356234363035353666326332393b30303030303030303b3030303034534534343030303032303b636f6d2e6170706c652e6170702d73616e64626f782e726561642d77726974653b30303030303030313b30313030303030323b303030303030303030303035633134613b2f75736572732f69706874656368322f646f776e6c6f616473

For more information search for -- "NSURLBookmarkCreationWithSecurityScope"



来源:https://stackoverflow.com/questions/24815984/mac-app-sandboxing-updating-files-outside-the-sandbox

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