Sandbox:bookmarkDataWithOptions和错误是零,没有解释

时间:2013-02-05 22:47:43

标签: objective-c cocoa appstore-sandbox

我正在沙盒化我的应用。当我致电-bookmarkDataWithOptions: includingResourceValuesForKeys:relativeToURL:error:时,我收到nil而没有任何解释(错误对象也是nil)。

  • 该应用已正确签名
  • 我创建了这些权利:
<dict>
  <key>com.apple.security.app-sandbox</key>
  <true/>
  <key>com.apple.security.files.user-selected.read-write</key>
  <true/>
  <key>com.apple.security.network.client</key>
  <true/>
  <key>com.apple.security.files.bookmarks.app-scope</key>
  <true/>
</dict>
</plist>
  • 我正在使用以下代码创建书签:
NSError *error = nil; 

// nextfile is NSURL and comes from NSOpenPanel

NSData *fileURLSecureData = [nextFile bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope 
                               includingResourceValuesForKeys:nil
                                                relativeToURL:nil
                                                        error:&error]; 

if (error) {
    ALog(@"Error securing bookmark %@", error);
}

我知道,当我逐步调试调试器中的代码时,执行fileURLSecureDataerrornil都是-bookmarkDataWithOptions: includingResourceValuesForKeys:relativeToURL:error:

我一定错过了什么。我已阅读并重新阅读论坛和文章,但我无法弄清楚我做错了什么。

1 个答案:

答案 0 :(得分:1)

解决。问题很简单。在Xcode中我无意中取消选中&#34;启用权利&#34;对于Dev配置,请检查Release版本。