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
  •  | 
  •  

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top