MBRecognizerRunnerViewControllerDelegate

Objective-C

@protocol MBRecognizerRunnerViewControllerDelegate <NSObject>

Swift

protocol MBRecognizerRunnerViewControllerDelegate : NSObjectProtocol

Protocol for MBRecognizerRunnerViewController actions

  • Scanning library requested authorization for Camera access from the user, but the user declined it. This case means scanning cannot be performed, because accessing camera images is now allowed.

    In this callback you have the chance to handle this case and present some kind of a message to the user on top of scanningViewController.

    Declaration

    Objective-C

    - (void)recognizerRunnerViewControllerUnauthorizedCamera:
        (nonnull UIViewController<MBRecognizerRunnerViewController> *)
            recognizerRunnerViewController;

    Swift

    func recognizerRunnerViewControllerUnauthorizedCamera(_ recognizerRunnerViewController: Any!)

    Parameters

    recognizerRunnerViewController

    Scanning view controller which was responsible for scanning

  • Scanning library found an error. The error object is returned and contains description of the error, in a specified language. Do your error handling here.

    Currently, only one situation can result with this callback being called:

    • Using camera session resulted with AVCaptureSessionRuntimeErrorNotification notification

    The best way to handle this is to Log the error (GA, Crashlytics, Flurry) and let the user continue using the app.

    Declaration

    Objective-C

    - (void)recognizerRunnerViewController:
                (nonnull UIViewController<MBRecognizerRunnerViewController> *)
                    recognizerRunnerViewController
                              didFindError:(nonnull NSError *)error;

    Swift

    func recognizerRunnerViewController(_ recognizerRunnerViewController: Any!, didFindError error: Error)

    Parameters

    recognizerRunnerViewController

    Scanning view controller which was responsible for scanning

    error

    Error object describing the error

  • Scanning library was closed, usually by the user pressing close button and cancelling the scan

    Declaration

    Objective-C

    - (void)recognizerRunnerViewControllerDidClose:
        (nonnull UIViewController<MBRecognizerRunnerViewController> *)
            recognizerRunnerViewController;

    Swift

    func recognizerRunnerViewControllerDidClose(_ recognizerRunnerViewController: Any!)

    Parameters

    recognizerRunnerViewController

    Scanning view controller responsible for scanning

  • Called when Scanning library will display help. This can happen when the user presses help button on scanning UI, or on first run of the application

    Declaration

    Objective-C

    - (void)recognizerRunnerViewControllerWillPresentHelp:
        (nonnull UIViewController<MBRecognizerRunnerViewController> *)
            recognizerRunnerViewController;

    Swift

    func recognizerRunnerViewControllerWillPresentHelp(_ recognizerRunnerViewController: Any!)

    Parameters

    recognizerRunnerViewController

    recognizerRunnerViewController Recognizer runner view controller responsible for scanning

  • Called when Scanning library is resuming scanning.

    Declaration

    Objective-C

    - (void)recognizerRunnerViewControllerDidResumeScanning:
        (nonnull UIViewController<MBRecognizerRunnerViewController> *)
            recognizerRunnerViewController;

    Swift

    func recognizerRunnerViewControllerDidResumeScanning(_ recognizerRunnerViewController: Any!)

    Parameters

    recognizerRunnerViewController

    recognizerRunnerViewController Recognizer runner view controller responsible for scanning

  • Called when Scanning library is stopped scanning.

    Declaration

    Objective-C

    - (void)recognizerRunnerViewControllerDidStopScanning:
        (nonnull UIViewController<MBRecognizerRunnerViewController> *)
            recognizerRunnerViewController;

    Swift

    func recognizerRunnerViewControllerDidStopScanning(_ recognizerRunnerViewController: Any!)

    Parameters

    recognizerRunnerViewController

    recognizerRunnerViewController Recognizer runner view controller responsible for scanning

  • Called when Scanning library will turn on/off torch.

    Declaration

    Objective-C

    - (void)recognizerRunnerViewController:
                (nonnull UIViewController<MBRecognizerRunnerViewController> *)
                    recognizerRunnerViewController
                              willSetTorch:(BOOL)isTorchOn;

    Swift

    optional func recognizerRunnerViewController(_ recognizerRunnerViewController: Any!, willSetTorch isTorchOn: Bool)

    Parameters

    recognizerRunnerViewController

    recognizerRunnerViewController Recognizer runner view controller responsible for scanning

    isTorchOn

    isTorchOn Returns YES if torch mode was set successfully, otherwise NO.