Op 20 mrt. 2014, om 02:50 heeft Charles Srstka <[email protected]> het volgende geschreven:
> On Mar 19, 2014, at 7:29 PM, patrick machielse <[email protected]> wrote: > >> According to the documentation: >> >> "When you call the stopAccessingSecurityScopedResource method, you >> immediately lose access to the resource in question (even if you have >> previously called startAccessingSecurityScopedResource more than once)." >> >> Thus, as soon as 1 thread executes its >> 'stopAccessingSecurityScopedResource', all access in other threaded code >> blocks is lost. > > Have you tried using CFURLStartAccessingSecurityScopedResource instead of > -startAccessingSecurityScopedResource? This is what the documentation has to > say about it: > > "Calls to the CFURLStartAccessingSecurityScopedResource function (or its > Cocoa equivalent) are nestable on a per-process basis. This means that if > your app calls the start method on a URL twice, to fully relinquish access to > the referenced resource you must call the corresponding stop method twice." > > Of course, it also claims that the Cocoa method does this, so who knows. It seems that the description of CFURLStartAccessingSecurityScopedResource() is correct and also applies to -[NSURL startAccessingSecurityScopedResource]. I've reported this error to the documentation team. It turned out that I wasn't resolving the bookmarks correctly from within the sandbox. This made the call to 'startAccessingSecurityScopedResource' fail, but because the powerbox already enables access to the resource this would not be problematic for the first user of the url. Only when that user stopped accessing the url, and the next user would try to use it, the problems would start. Thanks for your input. patrick -- Patrick Machielse Hieper Software http://www.hieper.nl [email protected] _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
