Using Security Scoped Bookmarks on a folder that was recreated

I have a sandbox application that uses bookmarks and are frequently used on external volumes. Let's say I created a Security Scoped Bookmark on a user's external volume "d" and do read/write operations on it from time to time. What should I do when the user recreates volume "d"? I.e. what if the user goes into Disk Utility and does an Erase on the volume, using the same name. Do I need to wait for the user to allow the app to use the volume again or is there a way for me to manually ask for permission? Any best practices for this case scenario?

Accepted Reply

So, just to be clear, if the user deletes something and then re-creates something else with the same name, that’s a different item from the perspective of security scopes.

Do I need to wait for the user to allow the app to use the volume again or is there a way for me to manually ask for permission?

Standard practice here is to present the standard open panel asking the user to locate the item, configuring is so that it defaults to where you expect the item to be.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Replies

So, just to be clear, if the user deletes something and then re-creates something else with the same name, that’s a different item from the perspective of security scopes.

Do I need to wait for the user to allow the app to use the volume again or is there a way for me to manually ask for permission?

Standard practice here is to present the standard open panel asking the user to locate the item, configuring is so that it defaults to where you expect the item to be.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Standard practice here is to present the standard open panel asking the user to locate the item, configuring is so that it defaults to where you expect the item to be.

Thank you for this perspective!