• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Need help passing a Secure Bookmark to an XPC Service
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need help passing a Secure Bookmark to an XPC Service


  • Subject: Need help passing a Secure Bookmark to an XPC Service
  • From: douglas welton <email@hidden>
  • Date: Wed, 24 Oct 2012 17:56:17 -0400

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?

curiously,

douglas
_______________________________________________

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


  • Follow-Ups:
    • Re: Need help passing a Secure Bookmark to an XPC Service
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: Running a-foul of bindings with multiple-value subfields
  • Next by Date: Re: Need help passing a Secure Bookmark to an XPC Service
  • Previous by thread: Re: Plan for persisting preferences on iOS applications
  • Next by thread: Re: Need help passing a Secure Bookmark to an XPC Service
  • Index(es):
    • Date
    • Thread