NSHTTPCookieStorage +沙盒
我在将 [NSHTTPCookieStorage sharedHTTPCookieStorage]
与沙盒结合时遇到问题。看起来该类无法访问位于 ~/Library/Cookies
中的 Cookies.binarycookies
文件,即使我已在我的权利文件中允许此位置允许路径的 com.apple.security.temporary-exception.files.home-relative-path.read-write
数组。
除此之外,这是 Apple 制作的类,即使不进行此修改也应该可以工作。
我也尝试过 - (id)initWithStorageLocation:(NSURL*)storageFileURL
,但是这已在 Mac OS X 10.6 中引入,并在 Mac OS X 10.7 中默默删除,因此我也无法使用它。
我能做些什么?所有方法,例如 - (NSArray *)cookies
均不返回任何内容。
我正在使用 10.7 SDK 和最新版本的 Xcode 进行构建。
编辑:我曾与 Apple 工作人员交谈过,他说沙盒中的 Cookie 访问系统与 iOS 相同。这意味着如果没有您自己的实现(我现在将创建),您永远无法访问全局 Cookie 数据库。 NSHTTPCookieStorage
只会在沙箱中显示您自己的 Cookie。
I am having problems with combining [NSHTTPCookieStorage sharedHTTPCookieStorage]
with Sandboxing. It appears like the class has no access to the Cookies.binarycookies
file that is located in ~/Library/Cookies
, even though I have allowed this location in my entitlements file in the com.apple.security.temporary-exception.files.home-relative-path.read-write
array of permitted paths.
Apart from that, this is an Apple made class and should be working even without this modification.
I have also tried - (id)initWithStorageLocation:(NSURL*)storageFileURL
, however this has been introduced in Mac OS X 10.6 and silently removed in Mac OS X 10.7, so I cannot use this either.
What can I do? All methods such as - (NSArray *)cookies
return nothing.
I am building using the 10.7 SDK and the newest version of Xcode.
Edit: I've talked to someone who works for Apple and he's saying that the Cookie access system when sandboxed is identical to the iOS one. This means that you can never access the global Cookie database without your own implementation (which I will create now). NSHTTPCookieStorage
will only reveal your own Cookies when sandboxed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看控制台应用程序的日志 - 如果是沙箱问题,它应该留下有关失败原因的更多详细信息。您可以使用它来查找可能需要允许其工作的其他临时异常。
仅仅因为它是 Apple 制作的课程,并不意味着它会起作用。我的一个使用 Apple 的 CoreMIDI API 的应用程序遇到了问题 - 必须添加一些晦涩的 com.apple.security.temporary-exception.mach-lookup.global-name 权利才能使其正常工作。
Have a look in the logs from Console app – if it's a sandboxing issue, it should leave a little more detail about the reason it's failing. You can use that to find other temporary exceptions you might need to allow it to work.
Just because it's an Apple made class, it doesn't mean it will work. I had an issue with one of my apps using Apple's CoreMIDI API – had to add a couple of obscure
com.apple.security.temporary-exception.mach-lookup.global-name
entitlements to make it work.