我正在创建一个应用程序(用于Cydia),允许用户下载其他.app并安装它们。一切都下载得很好,但是当我移动文件时,我碰到了一堵砖墙。
代码:
//Start Moving
NSString *str = textDownload.text;
str = [str stringByReplacingOccurrencesOfString:@".zip"
withString:@".app"];
NSString *placeToMoveFile = [NSString stringWithFormat:@"mv %@/%@ /Applications/", documentsDirectory, str];
NSLog(placeToMoveFile);
const char *runCommand = [placeToMoveFile UTF8String];
system(runCommand);
我开始有点创意了(LOL)
我认为问题出现在system()
内部。系统甚至不会在模拟器中向控制台提供输出。就像注意一样,该应用以root身份运行,因此我尝试将文件移至/ Applications时不会出现权限错误。