Search code examples
avfoundation

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


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


Solution

  • From the documentation

    https://developer.apple.com/documentation/avfoundation/avfoundation_constants?language=objc

    and here is some filler text for your amusement.