Skip to content

[iOS] App crashes with Fatal error when camera permission is denied (VideoCapture.swift:89) #420

@seki000

Description

@seki000

Search before asking

Project area

iOS build

Bug

The package crashes immediately when camera permission is denied or not yet granted on iOS. This is caused by the use of try! when initializing AVCaptureDeviceInput in VideoCapture.swift.

Steps to Reproduce
1.Run the app on an iOS device.
2.When the camera permission dialog appears, select "Don't Allow" (or disable camera permission in Settings).
3.The app crashes with a fatal error.

Error Log
ultralytics_yolo/VideoCapture.swift:89: Fatal error: 'try!' expression unexpectedly raised an error:
Error Domain=AVFoundationErrorDomain Code=-11852 "背面カメラを使用できません"
UserInfo={NSLocalizedDescription=背面カメラを使用できません, ...}

Environment

  • OS: macOS Sequoia 15.5
  • Language or framework version: Flutter 3.38.5
  • Package or app version: ultralytics_yolo 0.1.40
  • Hardware: iphone 16e
  • iOS Version: 18.6.2
  • Any other environment details: The crash occurs specifically when camera permission is denied or restricted.

Minimal Reproducible Example

  1. Install the app on an iOS device.
  2. When the system camera permission dialog appears, select "Don't Allow".
  3. The app crashes immediately due to a Fatal error in the native Swift code.

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingembeddedPertaining to IOT or low-power devicesfixedBug has been resolved

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions