Error Domain=NSCocoaErrorDomain Code=513

When I want to save my array (HTML shape) I have this error.

"Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “Untitled.xls” in the folder “Desktop”." UserInfo={NSFilePath=/Users/gerardbuguet/Desktop/Untitled.xls, NSUnderlyingError=0x60400044d8c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}"

I do not understand why.

How can I resolve this issue ?

Thanks in advance.

Replies

Have a look at this thread, may help you : h ttps://forums.developer.apple.com/thread/63075

Hello, I think that you can help me. How can I be permitted to write a file without 'not permitted' ?

it works with 'NSURL *documentsDirectory = [fm URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask].lastObject;' but not with

"fichier = @"/Users/gerardbuguet/Desktop/";"

I want to write my HTMLText in a Excel file (.xls).


Thanks in advance.

folder "Desktop" usually is MacOS.. that thread was iOS..


close, but still two different beasts..


is there a MacOS info.plist setting to request file access to the Desktop?


(I can't believe we're at the bizarre state to have to ask permission for an app to create a folder on the Desktop)

(I can't believe we're at the bizarre state to have to ask permission for an app to create a folder on the Desktop)

This doesn’t surprise me given the number of bad actors out there.

is there a MacOS info.plist setting to request file access to the Desktop?

There’s different answers here depends on whether your app is sandboxed or not?

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"