Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.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
Ios NSFileCoordinator将项目移动到雪豹中的其他url时崩溃_Ios_Objective C_Cocoa_Objective C Blocks - Fatal编程技术网

Ios NSFileCoordinator将项目移动到雪豹中的其他url时崩溃

Ios NSFileCoordinator将项目移动到雪豹中的其他url时崩溃,ios,objective-c,cocoa,objective-c-blocks,Ios,Objective C,Cocoa,Objective C Blocks,我使用了NSFileCoordinator对象将文件从一个位置移动到另一个位置,如下所示。我正在使用dispatch\u asyncAPI在块内执行此操作 NSFileCoordinator* coordinator = [[NSFileCoordinator alloc] init]; NSString* srcPath = @"some path"; NSString* destPath = @"dest path"; NSURL* srcLocation = [NSURL urlWit

我使用了
NSFileCoordinator
对象将文件从一个位置移动到另一个位置,如下所示。我正在使用
dispatch\u async
API在块内执行此操作

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] ItemAttribute:willMoveToURL::发送到实例的选择器无法识别 0x7f7f921c3d70'


出现此问题的原因可能是什么?

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

感谢您提供此信息。哎呀!我应该检查一下方法文档。