我有一个可可包装器,可以进行一些配置,然后将应用程序从其Resources文件夹复制到/ Applications。副本无效。以下是执行复制的代码。
-(BOOL)copyAppBundle
NSError * error;
BOOL isDir;
//get path to application bundle
NSBundle * mainBundle = [NSBundle mainBundle];
NSString * appSrcPath = [[mainBundle bundlePath]stringByAppendingString:@"/Contents/Resources/Bogus.app"];
NSString * appTgtPath = @"/Application/Bogus.app";
if ([[NSFileManager defaultManager]fileExistsAtPath:appSrcPath isDirectory:&isDir])
{
//copy the bundle to /Applications
[[NSFileManager defaultManager]copyItemAtPath:appSrcPath toPath:appTgtPath error:&error];
}
//check the results
if ([[NSFileManager defaultManager]fileExistsAtPath:@"/Application/Bogus.app"])
{
appCopyResults = TRUE;
}
return appCopyResults;
副本失败。是否有一个我缺少的步骤或有更好的方法来做到这一点?