【问题标题】:How do I get getpwuid to work in my mac app?如何让 getpwuid 在我的 mac 应用程序中工作?
【发布时间】:2012-06-13 00:19:15
【问题描述】:

我正在尝试让我的沙盒 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

我错过了什么?

【问题讨论】:

    标签: macos mac-app-store getpwuid


    【解决方案1】:

    我忘了

     #include <pwd.h>
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-15
      • 1970-01-01
      • 2016-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-07
      • 1970-01-01
      相关资源
      最近更新 更多