我是Objective-C的新手。將應用程序的內容複製到桌面編程式
如何將我的整個.app
包([[NSBundle mainBundle] bundleURL]
)以編程方式複製到我的桌面?
這是我的代碼,但沒有幫助我。
NSString *sourcepath = [[NSBundle mainBundle] bundlePath];
NSString *destpath = [NSHomeDirectory() stringByAppendingPathComponent:@"Desktop"];
[[NSFileManager defaultManager] copyItemAtPath:sourcepath toPath:destpath error:nil];
確實有意義在用戶的硬盤上創建應用程序的克隆?你究竟在努力實現什麼?某些* Windows *類似於桌面上的別名? – Jay 2013-04-11 09:04:02
其實我只是想知道如何在目標c中以編程方式複製。我試圖使用[[NSFileManager的defaultManager],但它不幫助我可能是我可能是錯的地方。 – fazal 2013-04-11 09:12:24
您是否添加了錯誤處理和'NSLog()' - 是否返回了一個'NSError'? – Jay 2013-04-11 12:09:44