An error occurred using the Avfoundation Library on iOS for video recording:
Error domain=avfoundationerrordomain code=-11823 "cannot store" userinfo=0x1782f8a00 {nsunderlyingerror=0x17064f4e0 "" Operation couldn ' t be completed. (Osstatus error-12672.) ", Averrorrecordingsuccessfullyfinishedkey=false, nslocalizedrecoverysuggestion= please retry the storage. , nslocalizeddescription= cannot store},video.mov--file:///var/mobile/Applications/D0CA65C7-F218-46F1-80BC-B0FA886EDF3B/ documents/
For some English-language machines, the display is:
Error domain=avfoundationerrordomain code=-11823 "Cannot Save" Userinfo=0x16fb20 {nslocalizedrecoverysuggestion=try Saving again., Nslocalizeddescription=cannot Save}
Error Domain=avfoundationerrordomain code=-11823 The reason for this is that you need to write a file, but the file exists. Do not know why iOS does not allow direct coverage? On Android, the same logic doesn't matter.
Know the cause of the problem, then the solution is also very simple, each time before recording the video (before writing the file), check the existence of the file, the existence of the deletion can be:
If the file exists, delete the
if ([[[Nsfilemanager Defaultmanager] Fileexistsatpath:[documentsdirpath stringbyappendingpathcomponent:@ "Video.mp4" ]]) {
Nserror *error;
if ([[[Nsfilemanager Defaultmanager] Removeitematpath:[documentsdirpath stringbyappendingpathcomponent:@ "Video.mp4" ] error:&error] = = NO) {
NSLog (@ "removeItemAtPath%@ error:%@", [Documentsdirpath stringbyappendingpathcomponent:@ "Video.mp4"], error);
}
}
After the modification, there is no problem