我正在沙盒化我的应用。当我致电-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); }
我知道,当我逐步调试调试器中的代码时,执行fileURLSecureData
后error
和nil
都是-bookmarkDataWithOptions: includingResourceValuesForKeys:relativeToURL:error:
我一定错过了什么。我已阅读并重新阅读论坛和文章,但我无法弄清楚我做错了什么。
答案 0 :(得分:1)
解决。问题很简单。在Xcode中我无意中取消选中&#34;启用权利&#34;对于Dev配置,请检查Release版本。