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.
题
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?
解决方案
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.