我使用NSFileCoordinator对象将文件从一个位置移动到另一个位置,如下所示。我正在使用dispatch_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',原因:‘-NSFile协调员itemAtURL:willMoveToURL::未识别的选择器发送到实例0x7f7f921c3d70’
这个问题的原因是什么?
发布于 2014-05-24 14:36:36
因为该方法在OSXv10.8中是可用的,所以later.You在10.7中不能使用它。
https://stackoverflow.com/questions/23844219
复制相似问题