如何通过Xcode应用程序发送当前目录path(path中的空间)到terminal

我必须从Objective C代码运行一个脚本。 我的脚本server.js位于path

/ Users / SS / Desktop / iPhone App / Appium.app / Contents / Resources / node_modules / appium / server.js

在目标C代码中,我将path设置为

[self.serverTask setCurrentDirectoryPath:[NSString stringWithFormat:@“%@ /%@”,@“/ Users / SS / Desktop / iPhone App / Appium.app / Contents / Resources”,@“node_modules / appium”]];

带有参数的发射path

[self.serverTask setLaunchPath:@“/ bin / bash”]; [self.serverTask setArguments:[NSArray arrayWithObjects:@“ – l”,@“ – c”,nodeCommandString,nil]];

我面对的问题是,当我运行XCode应用程序时,它只接收空间之前的path(即/ Users / SS / Desktop / iPhone ),并通过一个错误

/ bin / bash:/ Users / SS / Desktop / ab:没有这样的文件或目录

是否有一个想法,我可以访问空间后的path。

在双引号内发送你的appium的path。

像这样改变你的path./

[self.serverTask setCurrentDirectoryPath:[NSString stringWithFormat:@"%@/%@", @"/Users/SS/Desktop/iPhone\ App/Appium.app/Contents/Resources", @"node_modules/appium"]]; 

在空格前加\

用下面的双引号发送你的appium的path。

 [self.serverTask setCurrentDirectoryPath:[NSString stringWithFormat:@"%@/%@", @"/Users/SS/Desktop/iPhone\ App/Appium.app/Contents/Resources", @"node_modules/appium"]];