Unable to write file on mac app using the com.apple.security.files.user-selected.read-write entitlement

I have created a mac app and I keep getting following error, "Deny file-write-create". I have added the

This is my entitlement file

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>com.apple.security.app-sandbox</key>

<true/>

<key>com.apple.security.application-groups</key>

<string>XXXXXXXX</string>

<key>com.apple.security.files.user-selected.read-write</key>

<true/>

</dict>

</plist>


I keep getting "deny file-write-create" Application doesn't have the permissions to perform this action.


Any help would be greatly appreciated.


Thanks

It’s hard to say what’s going on here without more information about the place you’re trying to write to. The expected behaviour for the

com.apple.security.files.user-selected.read-write
entitlement is as follows:
  1. Your app puts up a standard save panel (NSSavePanel)

  2. The user choses a save location

  3. As part of that process the OS punches a hole in your app’s sandbox to allow it to write to that location

  4. Your app gets that URL from the save panel

  5. Your app saves to that location

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"
Unable to write file on mac app using the com.apple.security.files.user-selected.read-write entitlement
 
 
Q