Mac App沙箱-在沙箱外部更新文件 [英] Mac App Sandboxing- Updating files outside the sandbox

查看:223
本文介绍了Mac App沙箱-在沙箱外部更新文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要在App Store上发布的Mac应用程序. 为了将其发布,我需要将其放入沙箱中. 应用程序访问用户从openpanel选择的沙箱外部的Sqlite文件. 当执行选择时,该应用程序工作正常,但在插入和更新时失败. 我可以记得读过一些有关您可以调用的函数的信息,这些函数可以使您对沙箱外部的文件进行写访问,但终生我记得什么是开导我的思想?

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

推荐答案

在项目的授权文件中添加具有布尔值YES的"com.apple.security.files.bookmarks.app-scope".添加此链接的带有沙箱"部分-

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/

使用URLByResolvingBookmarkData:方法解析URL时,您将获得如下所示的URL-

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

有关更多信息,请搜索-"NSURLBookmarkCreationWithSecurityScope"

For more information search for -- "NSURLBookmarkCreationWithSecurityScope"

这篇关于Mac App沙箱-在沙箱外部更新文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆