NSFileManager moveItemAtPath问题 [英] NSFileManager moveItemAtPath issue
问题描述
我正在使用NSFileManager将项目从一个文件路径移动到另一文件路径,但这会导致异常.但是我每次都不会得到异常,只有在第二次或第三次加载网址后才会引发该异常
I am using NSFileManager to move items from one file path to another file path but it results in an exception.But i dont get exception every time, the exception is raised only after second or third time of loading the urls
Exception Error Domain = NSCocoaErrorDomain代码= 4该操作无法完成.(可可错误4.)"UserInfo = 0x631a900{NSUserStringVariant =移动,NSFilePath =/Users/cgvak/Library/Application支持/iPhoneSimulator/4.3/Applications/3731EEFB-03F8-4E0B-BF5D-A94BEE0D2DE2/Library/Caches/imgcache//loading/http:__ www.sankar.com.au_sankar_property_photo_2010_09_30_dc_a4f35e82e70002604f6c06fd811f9d_m.NSDestinationFilePath =/用户/cgvak/库/应用程序支持/iPhoneSimulator/4.3/Applications/3731EEFB-03F8-4E0B-BF5D-A94BEE0D2DE2/Library/Caches/imgcache//ready/http:__ www.sankar.com.au_sankar_property_photo_2010_09_30_dc_a4f35e82e70002604f6c06fd811f9d_m.
Exception Error Domain=NSCocoaErrorDomain Code=4 "The operation couldn’t be completed. (Cocoa error 4.)" UserInfo=0x631a900 {NSUserStringVariant=Move, NSFilePath=/Users/cgvak/Library/Application Support/iPhone Simulator/4.3/Applications/3731EEFB-03F8-4E0B-BF5D-A94BEE0D2DE2/Library/Caches/imgcache//loading/http:__www.sankar.com.au_sankar_property_photo_2010_09_30_dc4a35f82ee70002604f6c06fd811f9d_m.jpg, NSDestinationFilePath=/Users/cgvak/Library/Application Support/iPhone Simulator/4.3/Applications/3731EEFB-03F8-4E0B-BF5D-A94BEE0D2DE2/Library/Caches/imgcache//ready/http:__www.sankar.com.au_sankar_property_photo_2010_09_30_dc4a35f82ee70002604f6c06fd811f9d_m.jpg}
为了克服这个问题我该怎么办?请任何人帮助我克服这个问题.
What should i do in order to overcome from this problem?Please any body help me to overcome from this problem.
谢谢.
推荐答案
您检查路径是否存在?在文件路径中也有一个//.尝试删除那个.
Have you checked that the path exists? also there is an // in the file path. Try to remove that one.
您还可以将您的代码发布出来,而没有我们真正不得不猜测的代码.
Could you also post you code, with out code we really have to guess.
可可错误4
表示您正在尝试移动不存在的文件,这也可能意味着目标目录不存在.
The Cocoa error 4
means that you are trying to move a file that does not exist, this could also mean that the target directory does not exists.
这篇关于NSFileManager moveItemAtPath问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!