title: Unable to access desktop file from a macOS app
body: <p>I am not sure what I am doing wrong here. I have a simple snippet of code :</p>
  <pre><code>    NSError *error = nil;
      NSString *string = [NSString stringWithContentsOfFile:@&quot;/Users/myuser/Desktop/test.csv&quot; encoding:NSUTF8StringEncoding error:&amp;error];
      NSLog(@&quot;Error %@&quot;,error);
  </code></pre>
  <p>which when I run I get the error :</p>
  <pre><code>Error Domain=NSCocoaErrorDomain Code=257 &quot;The file “test.csv” couldn’t be opened because you don’t have permission to view it.&quot; UserInfo={NSFilePath=/Users/myuser/Desktop/test.csv, NSUnderlyingError=0x600002388fc0 {Error Domain=NSPOSIXErrorDomain Code=1 &quot;Operation not permitted&quot;}}
  </code></pre>
  <p>I am adding this snippet of code in an existing app which has a Application Sandbox section. If I take this same snippet and put in a brand new app, then it works fine but the new app does not have a App Sandbox section. What am I missing here? How do I ask for permission to access the Desktop folder?</p>