How do I find the error code in iOS when I use AVFoundation class

Go To StackoverFlow.com

2

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

2012-04-03 22:06
by Howy
I get the -12670 error code too with a phone with a full disk, so would be expecting AVErrorDiskFull (which is -11807 - Jonathon Horsman 2012-07-19 10:00


0

From the documentation

http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVFoundation_ErrorConstants/Reference/reference.html#//apple_ref/doc/uid/TP40009935

and here is some filler text for your amusement.

2013-07-15 10:52
by Flax
In case anyone is looking at this now, this link is broken - Vaddadi Kartick 2017-07-16 03:06
Apple seems to have deactivated the links. :(

https://developer.apple.com/documentation/avfoundation/avfoundation_constants?language=obj - Flax 2017-07-17 12:09

You can look up the error codes by printing their 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



1

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.)"}*
2014-03-26 00:05
by jhk
Ads