2014-05-24 22 views
0

我已經使用NSFileCoordinator對象將文件從一個位置移動到另一個位置。我正在使用dispatch_async API在塊內執行此操作。NSFileCoordinator將項目移動到Snow Leopard中的另一個URL時崩潰

NSFileCoordinator* coordinator = [[NSFileCoordinator alloc] init]; 

NSString* srcPath = @"some path"; 
NSString* destPath = @"dest path"; 

NSURL* srcLocation = [NSURL urlWithPath:srcPath]; 
NSURL* destLocation = [NSURL urlWithPath:destPath]; 

[coordinator itemAtURL:srcLocation willMoveToURL:destLocation]; 

我的部署目標是10.7。

當我在10.9中運行應用程序時,沒有錯誤並將文件移動到目標位置。但是,如果我在10.7中運行相同的應用程序。它提供了以下異常如:

***終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因是: ' - [NSFileCoordinator itemAtURL:willMoveToURL:]:無法識別的選擇發送到實例 0x7f7f921c3d70'

這個問題的原因是什麼?

回答

0

因爲該方法在OS X v10.8及更高版本中可用,您不能在10.7中使用它。

+0

感謝這個信息。哎呀!我應該檢查方法文件。 – boom

相關問題