Skip to content

Using iOS front camera causes crash when closing the page #978

@gwest

Description

@gwest

When using the front camera in iOS, closing the form will cause an application crash with the following stack trace:

Foundation.MonoTouchException Message=Objective-C exception thrown. Name: NSInvalidArgumentException Reason: *** -[AVCaptureDevice setFocusMode:] Unsupported focusMode - use -isFocusModeSupported: to discover valid focus modes

To reproduce the error on the latest master commit (f8abca8) I did the following

  1. In Sample.Forms.HomePage.cs, add code to make the "Scan with Default Overlay" use the front camera on line 31
    new ZXing.Mobile.MobileBarcodeScanningOptions { UseFrontCameraIfAvailable = true }
  2. Click the "Scan with Default Overlay" button to open the scanner.
  3. Click the "< ZXing.Net.Mobile" back button to close the scanner.

I've attached the full error in case it helps: Foundation.MonoTouchException.txt.

Tested with iPad (8th generation) on iOS 14.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions