Setting file permissions in Objective-C

北战南征 提交于 2019-12-31 03:44:05

问题


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:


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

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



来源:https://stackoverflow.com/questions/8257630/setting-file-permissions-in-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!