我试图通过NSTask挂载webdav共享(Windows Server 2008r2)。但没有运气。
NSString *server = @"https://domain;username:password@SERVER.tld:443/WDAV";
NSString *mountpoint = @"/Users/me/Desktop/MountPoint";
NSTask *task = [NSTask new];
task.launchPath = @"/sbin/mount_webdav";
task.arguments = @[server, mountpoint];
[task launch];
[task waitUntilExit];
int status = [task terminationStatus];
if (status == 0) {
NSLog(@"Mounted to Server");
} else {
NSLog(@"Mounted to Server failed with status code: %i", status);
}
退出代码始终为22
。
当我尝试通过终端连接时,我使用/sbin/mount_webdav -i "https://SERVER.tld:443/WDAV" "/Users/me/Desktop/MountPoint"
我必须在我的案例domain\username
和密码中键入用户名。在终端上运行良好,但在NSTask上我不知道。