title: Read and write permission for user selected folder in Mac OS app?
body: <p>I am developing MAC OS app which have functionality to create file on the behalf of your. First user select folder for storing file (One time at start of app) and then user can select type and name of the file user want to create on selected folder (Folder selected on start of the app) using apple script. I am able to create file when i add below <code>temporary-exception</code> in entitlement file but its not able to app apple review team but works in sandboxing. </p>
  
  <blockquote>
    <p>Guideline 2.4.5(i) - Performance
    We've determined that one or more temporary entitlement exceptions requested for this app are not appropriate and will not be granted:</p>
  </blockquote>
  
  <pre><code>com.apple.security.temporary-exception.files.home-relative-path.read-write
  /FolderName/
  </code></pre>
  
  <p>I found :</p>
  
  <p><a href="https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html" rel="noreferrer">Enabling App Sandbox</a> - Allows apps to write executable files.</p>
  
  <p>And </p>
  
  <p><a href="https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingAppSandbox.html#//apple_ref/doc/uid/TP40011195-CH4-SW7" rel="noreferrer">Enabling User-Selected File Access</a> - Xcode provides a pop-up menu, in the Summary tab of the target editor, with choices to enable read-only or read/write access to files and folders that the user explicitly selects. When you enable user-selected file access, you gain programmatic access to files and folders that the user opens using an <code>NSOpenPanel</code> object, and files the user saves using an <code>NSSavePanel</code> object.</p>
  
  <p>Using below code for creating file :</p>
  
  <pre><code>let str = "Super long string here"
  let filename = getDocumentsDirectory().appendingPathComponent("/xyz/output.txt")
  
  do {
      try str.write(to: filename, atomically: true, encoding: String.Encoding.utf8)
  } catch {
      // failed to write file – bad permissions, bad filename, missing permissions, or more likely it can't be converted to the encoding
  }
  </code></pre>
  
  <p>Also tried adding <code>com.apple.security.files.user-selected.read-write</code> in entitlement file for an NSOpenPanel object :</p>
  
  <pre><code>&lt;key&gt;com.apple.security.files.user-selected.read-write&lt;/key&gt;
  &lt;true/&gt;
  </code></pre>
  
  <p>Is there any way to get pass apple review team to approve Mac App with read and write permission to user selected folder ?</p>