NSTask Question

醉酒当歌 提交于 2019-12-06 08:45:25

Having a space in the argument does not look like your problem - note that the console is showing the pathname with a space. An argument with a space is passed as a single argument, I've just confirmed it will happily unzip @"a space.zip". Have you checked the file does exist where you think it does and you have access to it?

Why can't you embed the quote marks?

NSString *quotedPath = [NSString stringWithFormat:@"\"%@\"", path];
NSArray *arguments = [NSArray arrayWithObjects:zipPath, @"-d", quotedPath, nil];

Could you parse the path components using NSString's - (NSArray *)pathComponents method, add the quotes where needed, then rebuild the string using (NSString *)pathWithComponents:(NSArray *)components

Does that work?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!