Setting file permissions in Objective-C

2020-04-21 03:54发布

I managed to get my hands on a nifty ftp object. It is very low level and easy to adapt. I'm using it to transfer files from one Mac to another via FTP.

Now, the issue I'm having is that when the file, that is transfered, reaches its destination, the other Mac, the access permissions is set , at random intervals, to "Everyone" : "No Access". So sometimes, whatever I do with the files fails randomly because my application can't access the files.

Is there a way I can change the file's access permissions in Objective-C?

Regards, EZFrag

1条回答
姐就是有狂的资本
2楼-- · 2020-04-21 04:47

For permissons of local files, you'd want [NSFileManager setAttributes:ofItemAtPath:error:]

And the attribute dictionary you'd want to use would include NSFilePosixPermissions.

查看更多
登录 后发表回答