On 24 Oct 2012, at 22:56, douglas welton wrote: > Hi All, > > I am sending a NSURL, encoded as a Secure Bookmark, from the main part of my > sandboxed application to an XPC Service that handles a specific subtask. The > data is making it across the interface, but when I try to resolve the > bookmark back into an NSURL, I get the following error: > > 10/24/12 5:15:18.908 PM com.einsteinslegacy.silica.silicaHelper: --- > bookmark error: Error Domain=NSCocoaErrorDomain Code=259 "The file couldn’t > be opened because it isn’t in the correct format." UserInfo=0x7faf418069a0 {} > > Googling the text of the error message has not lead to any useful insights. > > Here's what I'm doing: > > • When a user selects a file, I create an object containing the URL and the > associated secure bookmark. > • I use NSKeyedArchive to create a data object, which I then pass to the XPC > service as a key-value pair in an xpc_dictionary. > • The XPC service receives the message, unpacks it and calls > NSKeyedUnarchiver to reconstitute the URL from the secure bookmark. > > At this point, I check the length of the bookmark data. The value matches > the length of the originally encoded bookmark. However, when I try to > resolve the URL using the following line of code, I get nil. > > self.url = [NSURL URLByResolvingBookmarkData: self.bookmark options: > NSURLBookmarkResolutionWithSecurityScope relativeToURL: nil > bookmarkDataIsStale: &isStale error: &bookmarkError]; > > The entitlements file used for the XPC Service is a duplicate of the main > application file. The XPCService dictionary in the service's info.plist has > "JoinExistingSession" set to YES, so I assume that both parts should have the > same set of entitlements. > > Are there other factors I need to consider when passing secure bookmarks?
You don’t need a security-scoped bookmark for this. Regular bookmarks carry access to the file until the computer next reboots. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com