> On 7 Sep 2016, at 2:12 PM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> In other words, don’t create the bookmark data every time in 
> ‘encodeWithCoder’. Instead, create it once when you first get the URL from 
> NSOpen/SavePanel, store it as a property, and archive that NSData object.


Ah, that makes (some) sense. I guess this is why it has worked for me in the 
past, because I haven’t repeatedly archived/dearchived in this way before, but 
instead I usually save something like this in the user defaults.

So, I’ve altered the code to do as you suggest. It avoids the problem I was 
having, though a couple of things are still questionable.

I still get the console messages:

2016-09-07 15:34:53.684 MyApp[9226:1630740] CFStringRef 
__CFPasteboardIssueSandboxExtensionForPath(CFStringRef) : sandbox extension 
creation failed: client lacks entitlements? for path: 
[/Users/grahamcox/Desktop/Exports/Snorkel0001-22.jpg]
2016-09-07 15:34:53.685 MyApp[9226:1630740] CFDataRef 
__CFPasteboardCreateSandboxExtensionDataFromCFData(CFDataRef) : failed to 
obtain sandbox extension data for url 
[file:///Users/grahamcox/Desktop/Exports/Snorkel0001-22.jpg]

These seem to be benign, but I would like to know where they’re coming from and 
why.

The other thing is this. According to docs, if ‘stale’ returns YES when 
resolving the bookmark data, then you should recreate the bookmark data from 
the URL that was returned. On the face of it, this doesn’t seem to be different 
from recreating it anyway, though I can certainly imagine that it’s a special 
case, given the weird nature of sandboxing.

Also, when using the -start… and -stop… methods to access resources, should the 
-stop method only be used if the start method returned YES, or used whatever? 
Docs aren’t clear.

Thanks for you help anyway, I have made some progress. I bloody hate the way 
sandboxing is implemented though, it’s just a PITA.

—Graham



_______________________________________________

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

Reply via email to