Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 复制应用程序包_Objective C - Fatal编程技术网

Objective c 复制应用程序包

Objective c 复制应用程序包,objective-c,Objective C,我有一个cocoa包装器,它进行一些配置,然后将应用程序从其资源文件夹复制到/Applications。复印件坏了。下面是执行复制的代码 -(BOOL)copyAppBundle NSError * error; BOOL isDir; //get path to application bundle NSBundle * mainBundle = [NSBundle mainBundle]; NSString * appSrcPath = [[mainBundle bundlePath]st

我有一个cocoa包装器,它进行一些配置,然后将应用程序从其资源文件夹复制到/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;

副本不合格。是否有我遗漏的步骤,或者有更好的方法来做到这一点?

它是如何失败的?你有错误吗?还是它什么都没做?我建议输入一些nslog,看看它在哪里打印出来。