我正在尝试通过 NSTask 使用以下tops命令:
tops replace "__My_CompanyName__" with "XYZ" TryItOut.m
但它总是给出以下错误:
File replace "__My_CompanyName__" with "XYZ" does not exist
通过终端执行时,它工作正常。
下面是我使用的代码:
NSTask *theTopsCommand = [[NSTask alloc] init];
[theTopsCommand setLaunchPath:@"/usr/bin/tops"];
[theTopsCommand setArguments:[[NSArray alloc] initWithObjects:@"replace \"__My_CompanyName__\" with \"XYZ\"", self.selectedFilePath,nil]];
[theTopsCommand launch];
[theTopsCommand waitUntilExit];
如果我做错了什么,谁能建议我?