I am programming a video app using AVFoundation library.
Basically, I am recording video to a file, and listens to the following event when recording finishes.
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error
{
switch([error code] {
//handle different AV foundation errors such as
case AVErrorMaximumFileSizeReached:
{ //do something }
case AVErrorMaximumDurationReached:
{ //do something }
case AVErrorDiskFull:
{ //do something }
}
}
When I ran my app in a low-disc space phone, I got a weirld error -12670
. I guess it's the similiar to diskfull, however, I couldn't find the error code in AVError.h
.
Is there any easy way to find the corresponding macros to a random error code? (I need to find the documentation of what exactly this error is about)
It's pretty confusing, I searched through the internet, and couldn't find anyone who knows the whole story.
Regards, Howard
From the documentation
and here is some filler text for your amusement.
https://developer.apple.com/documentation/avfoundation/avfoundation_constants?language=obj - Flax 2017-07-17 12:09
rawValue
. All available error codes are listed here: https://developer.apple.com/documentation/avfoundation/averror
To print the rawValue
, you can call print(AVError.diskFull.rawValue)
, which gives -11807
- flo_23 2017-07-27 15:00
This is an old error question but here's my answer. If you look at the NSError closer, it does show that the error code is -11807 (AVErrorDiskFull). Make sure you are not looking at the OSStatus error. You can find more about OSStatus error here.
Here is an example of the NSError:
Error Domain=AVFoundationErrorDomain
Code=-11807 "Operation Stopped"
UserInfo=0x16eabcf0 {NSLocalizedRecoverySuggestion=There is not enough available space to continue the file writing. Make room by deleting existing videos or photos.,
AVErrorRecordingSuccessfullyFinishedKey=false,
NSLocalizedDescription=Operation Stopped,
NSUnderlyingError=0x16e9e720
"The operation couldn’t be completed. (OSStatus error -12670.)"}*