0

我正在尝试让我的沙盒 mac 应用程序访问用户的真实主文件夹。

这是我尝试过的

const char *home = getpwent()->pw_dir;
NSString *path = [[NSFileManager defaultManager] 
              stringWithFileSystemRepresentation:home
              length:strlen(home)];
NSURL *url = [NSURL fileURLWithPath:path isDirectory:YES];

但我收到了这个错误:

Member reference type 'int' is not a pointer

我错过了什么?

4

1 回答 1

0

我忘了

 #include <pwd.h>

我会留下问题,以防其他人遇到问题!

于 2012-06-09T00:06:27.393 回答