确定,eXercice即将获得到正在运行的应用程序我有这样做的路径:问题的复制主要应用
NSFileManager *FManager = [ NSFileManager defaultManager ] ;
NSString *CurrentPath = [ FManager currentDirectoryPath ] ;
NSDictionary *infoPList = [[NSBundle mainBundle] infoDictionary];
NSString *appName = [infoPList objectForKey:@"CFBundleName"];
NSString *mainpath = [ CurrentPath stringByAppendingPathComponent:appName ] ;
NSString *mainFile = [ mainpath stringByAppendingString:@".app" ] ;
然后我尝试将主文件复制到主目录
NSString *homedir = NSHomeDirectory();
if ([ Fmanager fileExistsAtPath:mainfile ] == YES)
NSLog(@" File exist ") ;
else {
NSLog(@" not eXist ");
}
if ([ Fmanager copyItemAtPath:mainfile toPath:homedir error:NULL ] == YES) {
NSLog(@" COPY SUCC ") ;
}
else {
NSLog(@" COPY FAIL") ;
}
这里复制过程失败,它也告诉我,主文件甚至不eXists ... ou 任何人都可以帮我请 谢谢。
下次格式化您的代码。 – 2010-06-28 16:18:42