iPhone sdk-将文件移动到目录
我正在尝试将文件从一个路径移动到另一个路径的目录。我手头有密码。但是,它不能正常工作。我不知道那个密码有什么问题iPhone sdk-将文件移动到目录,iphone,ios4,file-manager,Iphone,Ios4,File Manager,我正在尝试将文件从一个路径移动到另一个路径的目录。我手头有密码。但是,它不能正常工作。我不知道那个密码有什么问题 if ([[NSFileManager defaultManager] moveItemAtPath:"path to be moved" toPath:"destination path" error:&error]) { NSLog(@"Moved"); } else { NSLog(@"Not moved:%@", [error localizedDes
if ([[NSFileManager defaultManager] moveItemAtPath:"path to be moved" toPath:"destination path" error:&error]) {
NSLog(@"Moved");
} else {
NSLog(@"Not moved:%@", [error localizedDescription]);
}
实际上,如果移动过程成功,将打印“移动”。但结果会打印错误消息“操作无法完成。(Cocoa错误512)。”。请帮我解决这个问题。提前谢谢 使用以下功能
[[NSFileManager defaultManager] copyItemAtPath:mainBundleFilePath
toPath:destPath
error:&err]
有关更多信息,请查看下面的SO帖子
尝试copyItemAtPath:toPath:error:而不是moveItemAtPath:toPath:error:,实际上我没有从mainBundle中移动文件。我必须将所选文件从文档目录移动到所选文件夹。如果使用“copyItemAtPath:”,则会显示错误消息“操作无法完成”。文件存在“@Developer:查看以下内容,因此post@Developer:很高兴知道它能帮助您