Solved. Problem was trivial. In Xcode I inadvertently unchecked "Enable Entitlement" for the Dev configuration, leaving it checked for Release builds.
Sandbox: bookmarkDataWithOptions and errors are nil without explanation
-
06-03-2022 - |
Question
I am sandboxing my app. When I call -bookmarkDataWithOptions: includingResourceValuesForKeys:relativeToURL:error:
I receive nil
without any explanation (the error object is nil
too).
- The app is correctly signed
- I created these entitlements:
<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>
- I'm creating the bookmark with this code:
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); }
I see, when I'm stepping through the code in the debugger, fileURLSecureData
and error
are both nil
after execution of -bookmarkDataWithOptions: includingResourceValuesForKeys:relativeToURL:error:
I must be missing something. I have read and re-read forums and articles but I am unable to figure out what I'm doing wrong.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow