Failure to create bookmarkData in sandboxed app
Failure to create bookmarkData in sandboxed app
- Subject: Failure to create bookmarkData in sandboxed app
- From: Antonio Nunes <email@hidden>
- Date: Sat, 11 May 2013 07:56:15 +0100
NSError *error = nil;
NSURLBookmarkCreationOptions options = NSURLBookmarkCreationSuitableForBookmarkFile | NSURLBookmarkCreationWithSecurityScope;
NSData *bookmarkData = [self.url bookmarkDataWithOptions:options
includingResourceValuesForKeys:nil
relativeToURL:nil
error:&error];
This code works fine in a non-sandboxed app (without the NSURLBookmarkCreationWithSecurityScope option). It also works fine in a sandboxed app, when I leave out the NSURLBookmarkCreationWithSecurityScope. However when I execute the code as written above in a sandboxed app the bookmarkDataWithOptions:etc… method returns nil, and an error: Domain=NSCocoaErrorDomain Code=256 "The file “xxx” couldn’t be opened."
self.url is a copy of a fileURL requested from an NSDocument.
I've added the com.apple.security.files.bookmarks.app-scope entitlement to the entitlements file, and checked "Use entitlements file". I want to create app scope bookmarks and I think the code above is correct. Is there anything else that needs to be set up, or am I misunderstanding anything? I can't find anything in the docs or by searching for similar problems (they turn up, but nowhere do I see a replica if this precise case, nor any pointers in somewhat similar cases that led me to a solution).
-António
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden