Keep getting the "access files in your Documents folder" question.

For my customers using Catalina, they're correctly asked once if my software can access files in their Documents folder, and then the issue is laid to rest.


But for me - I have two copies of the executable, the release build in my Applications folder, and the debug build I'm continuing to update. Whenever I switch from one of these to the other, I get the "*.app" would like to access files in your Documents folder prompt again.


Are other developers experiencing this? Why is it that having two copies of the same app causes this problem? How do I make it stop?


My app is called "Paisley", and it's loading a document from the ~/Documents/Paisley/ directory at startup.


        let docsDir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last
        _defaultDocumentsDirectory = docsDir!.appendingPathComponent("Paisley")


Then I "let data = try Data(contentsOf: _defaultDocumentsDirectory.appendingPathComponent("UserData.xml"))"

Replies

How are these two apps signed? Specifically, what does the following print for each app?

$ codesign -d -vvv -r - /path/to/your.app

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Is there a way to avoid this for when debugging applications on local desktops? This is very annoying, and sometimes takes upto 3min for every debug launch. Insane.
Are you toggling back and forward between two versions of your app that are signed differently? Or are you hitting this problem repeatedly launching the same version of your app?

Share and Enjoy

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

This does not work and is so annoying! Each time binary is rebuilt it asks for permission, even though it is added to Settings and was accepted before. Come on Apple fix your bugs!! I put my development files on Desktop normally but hell yeah, thanks to Apple I guess I need to move that.

That's a bug in macOS and needs to be fixed.

Post not yet marked as solved Up vote reply of slaj Down vote reply of slaj

Each time binary is rebuilt it asks for permission

If you can reproduce that problem with a executable that’s signed with a stable code signing identity, I would definitely consider that a bug and I encourage you to file a bug report about it. And if you do, please post your bug report, just for the record.

However, my experience is that the vast majority of folks hit this problem because their executable is not signed in a stable fashion, that is, it’s unsigned (not an option an Apple silicon) or ad hoc signed (Xcode calls this Signed to Run Locally).

If you post the output of the following command, I’ll be able to confirm this one way or the other:

% codesign -d -vvv -r - /path/to/your/executable

Share and Enjoy

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

After making sure the permission was on for the executable to access the folder, restarting my Mac fixed it for me. Appears that the permissions is not adhered to until the restart.

Edit: still getting the message, unfortunately. I wish it could be overridden for a specific executable.