Receive URL by NSService, Drop on App-Icon or NSView: how to determine if it's already in sandbox?

StackOverflow https://stackoverflow.com/questions/21877734

  •  13-10-2022
  •  | 
  •  

Question

The App Sandbox Design Guide suggests saving all Security Scoped Bookmarks into NSUserDefaults.

When the user drops for example his home directory onto our app, we'll save that SSB. After a while, the user may drop something inside his home directory on to the app. How do I find out if I have to store this NSURL again as SSB?

Was it helpful?

Solution

Maintain a cache as pairs of absolute path (remove any symlinks), security scoped bookmark.

When adding a new item if it is a child on any of the existing ones its not needed. Otherwise add it and if its the parent of one or more remove them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top