0
我用.m4a格式記錄了臨時目錄中的語音文件存儲我想在文檔目錄中移動該目錄。錄製的音頻文件不移動?
but I can not Move it I got error.
"The operation couldn’t be completed. (Cocoa error 4.)" UserInfo=0x7b660190 {NSSourceFilePathErrorKey=file:///Users/vinodjadhav/Library/Developer/CoreSimulator/Devices/067A2EAC-9987-4861-8746-97117DCE72F2/data/Containers/Data/Application/5744F8BC-4256-4010-8A14-60B228859F88/tmp/14-11-201410:32:45.m4a, NSUserStringVariant=(
Move
), NSFilePath=file:///Users/vinodjadhav/Library/Developer/CoreSimulator/Devices/067A2EAC-9987-4861-8746-97117DCE72F2/data/Containers/Data/Application/5744F8BC-4256-4010-8A14-60B228859F88/tmp/14-11-201410:32:45.m4a, NSDestinationFilePath=/Users/vinodjadhav/Library/Developer/CoreSimulator/Devices/067A2EAC-9987-4861-8746-97117DCE72F2/data/Containers/Data/Application/5744F8BC-4256-4010-8A14-60B228859F88/Documents/XpenseTag/Xpenses/sagar/823564440/audio/audio.m4a, NSUnderlyingError=0x7b660250 "The operation couldn’t be completed. No such file or directory"}
這是我的連結網址
Dest url = /Users/vinodjadhav/Library/Developer/CoreSimulator/Devices/067A2EAC-9987-4861-8746-97117DCE72F2/data/Containers/Data/Application/5744F8BC-4256-4010-8A14-60B228859F88/Documents/XpenseTag/Xpenses/sagar/823564440/audio/audio.m4a
這是我的源文件的URL
源URL =文件:///用戶/ vinodjadhav /庫/開發商/ CoreSimulator /設備/067A2EAC-9987-4861-8746-97117DCE72F2/data/Containers/Data/Application/5744F8BC-4256-4010-8A14-60B228859F88/tmp/14-11-201410:32:45.m4a
-(void)moveAudioFileFromeSource:(NSString *)sourceUrl toDest:(NSString *)destUrl
{
NSLog(@"source url = %@", sourceUrl);
NSError *Error;
if (![[NSFileManager defaultManager] moveItemAtPath:sourceUrl toPath:destUrl
error:&Error])
{
NSLog(@"Could not remove old files. Error:%@",Error);
}
}
我在哪裏錯了?
也不起作用 –
參考此答案http://stackoverflow.com/questions/12005104/iphone-copy-or-move-file-from-document-directory-folder – Sport
現在是什麼錯誤獲得? – Sport