I'm trying to copy a temp file to another location using NSFileManager. However it's failing and complaining that one of the files does not exists.
//Copy temp file
NSError *error;
BOOL exists = [fileManager fileExistsAtPath:chapterFileTemp];
exists = [fileManager fileExistsAtPath:chapterFile];
[fileManager copyItemAtURL:[NSURL fileURLWithPath:chapterFileTemp]
toURL:[NSURL fileURLWithPath:chapterFile]
error:&error];
//Delete temp path
[fileManager removeItemAtURL:[NSURL fileURLWithPath:chapterFileTemp] error:&error];
I'm getting error at copy operation
(Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260.)" UserInfo=0x1c5190b0 {NSFilePath=/var/mobile/Applications/57727CCD-88AD-4D84-8C78-EA8100645C9B/Documents/119/myFileTemp.temp, NSUnderlyingError=0x1c527960 "The operation couldn’t be completed. No such file or directory").
Now the first BOOL returns YES, and the second one NO. Which is expected.
What could be the reason for failure
Thanks.