最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Error Domain=AVFoundationErrorDomain Code=-11823 "无法存储"
时间:2022-06-25 23:36:36 编辑:袖梨 来源:一聚教程网
在IOS上使用AVFoundation的库进行视频录制,出现错误:
Error Domain=AVFoundationErrorDomain Code=-11823 "无法存储" UserInfo=0x1782f8a00 {NSUnderlyingError=0x17064f4e0 "The operation couldn’t be completed. (OSStatus error -12672.)", AVErrorRecordingSuccessfullyFinishedKey=false, NSLocalizedRecoverySuggestion=请重试存储。, NSLocalizedDescription=无法存储},video.mov -- file:///var/mobile/Applications/D0CA65C7-F218-46F1-80BC-B0FA886EDF3B/Documents/
对于一些英文语言的机器,显示的是:
Error Domain=AVFoundationErrorDomain Code=-11823 "Cannot Save" UserInfo=0x16fb20 {NSLocalizedRecoverySuggestion=Try saving again., NSLocalizedDescription=Cannot Save}
出现Error Domain=AVFoundationErrorDomain Code=-11823这个错误的原因都是需要写文件,但是文件是存在的。不知道为什么ios不允许直接覆盖?在android上,同样的逻辑没有任何问题。
知道问题的原因,那么解决也非常简单,每次再录制视频之前(写文件之前),检查文件是否存在,存在则删除即可:
//如果文件存在,则删除
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);
}
}
修改之后,没有任何问题
相关文章
- 将军留步最厉害三个阵容—最强阵容推荐 09-07
- 小小仙王清凉版本免费下载 无遮挡版本下载 09-07
- 天阶岛最厉害三个角色 英雄排行榜一览 09-07
- 大店小二0.1折下载—折扣平台在哪下载 09-07
- tplink路由器wr886n怎么设置桥接(tplink路由器wr886n设置桥接方法) 09-07
- 武侠大明星破解版免广告-mod作弊菜单 09-07