NSFileManager moveItemAtPath issue
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 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 m开发者_如何学运维e to overcome from this problem.
Thanks in advance.
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.
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.
Please Check NSSearchPathDirectory
Instead
NSArray * paths=NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES);
Write This
NSArray * paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
精彩评论