在Objective-C中设置文件权限 [英] Setting file permissions in Objective-C

查看:211
本文介绍了在Objective-C中设置文件权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法找到了一个漂亮的ftp对象.它的级别很低,很容易适应.我正在使用它通过FTP将文件从一台Mac传输到另一台Mac.

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.

现在,我遇到的问题是,当传输的文件到达其目的地(另一台Mac)时,访问权限会随机地设置为每个人":无访问权".因此,有时,我对文件所做的任何操作都会随机失败,因为我的应用程序无法访问文件.

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.

是否可以在Objective-C中更改文件的访问权限?

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

关于, EZFrag

Regards, EZFrag

推荐答案

对于本地文件许可,您需要

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

您要使用的属性字典将包括

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

这篇关于在Objective-C中设置文件权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆