如何使应用程序显示在终端中使用w命令登录到计算机的所有用户?在沙盒应用程序中运行外部程序
我做了测试版的应用程序,但它禁用了沙箱功能[它显示用户],但它不支持启用沙箱功能[它说没有用户登录]。代码是:
NSTask *task = [NSTask new];
[task setLaunchPath:@"/usr/bin/w"];
NSPipe *output = [NSPipe pipe];
[task setStandardInput:[NSPipe pipe]];
[task setStandardOutput: output];
[task launch];
NSFileHandle * read = [output fileHandleForReading];
NSData * dataRead = [read readDataToEndOfFile];
NSString *result = [[NSString alloc] initWithData:dataRead encoding:NSUTF8StringEncoding];
[TView setString: result];
是否有任何其他方法来查看可以与沙箱一起使用的登录用户? – user1792771