Re: Security-scoped bookmarks, what's going on?
Re: Security-scoped bookmarks, what's going on?
- Subject: Re: Security-scoped bookmarks, what's going on?
- From: Quincey Morris <email@hidden>
- Date: Tue, 06 Sep 2016 21:12:02 -0700
- Feedback-id: 167118m:167118agrif8a:167118sqLn7crw4C:SMTPCORP
On Sep 6, 2016, at 20:59 , Graham Cox <email@hidden> wrote:
>
> I’m having trouble with security-scoped bookmarks in a sandboxed app.
My understanding of security-scoped bookmarks (meaning: this used to be true ~2 years ago, but I haven’t tried recently to see if it’s still true) is that it’s not legal to re-create the bookmark data from a reconstituted security-scoped URL.
That is, the “fresh” security-scoped URL you get from NSOpen/SavePanel has these characteristics:
(a) you can create bookmark data that contains the security scoping for later reconstitution
(b) it doesn’t matter whether you issue “startAccessingSecurityScopedResource” or not
When you recreate a security-scoped URL from bookmark data:
(a) you cannot create new bookmark data that contains the security scoping
(b) you must issue “startAccessingSecurityScopedResource”.
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.
_______________________________________________
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