Error domain=avfoundationerrordomain code=-11823 "cannot store"

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.