確定,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