New
v0.1.45 - fix: ios crash camera permissions (#426)
π Summary (single-line synopsis)
v0.1.45 delivers a critical iOS camera-permission crash fix and strengthens Android camera lifecycle stability, making the Flutter YOLO camera experience far more reliable across real-world navigation and teardown scenarios π±π‘οΈ
π Key Changes
- π« iOS: Prevent fatal crashes when camera permission is denied/unavailable
- Adds an explicit camera authorization status check before attempting camera setup.
- Replaces unsafe forced unwrap/error paths (e.g.,
try!,fatalError) with safeguard+do-catchhandling. - Makes
bestCaptureDevice()nullable and guards camera setup + camera switching logic.
- βοΈ Android: Reduce dispose/teardown race-condition crashes
- Introduces a
@Volatile isStoppedflag and checks it throughout frame processing to avoid accessing released resources during/afterstop(). - Improves shutdown robustness by closing the predictor more safely.
- Introduces a
- π Android: Better camera startup + restart support
- Adjusts initialization order to set the lifecycle owner before starting camera.
- Adds a
restartCameramethod-channel hook, exposed viaYOLOViewController.restartCamera().
- π§ͺ Example app: More reliable camera restart when navigating back
- Forces a rebuild when returning to the camera route so the native view is recreated and the camera restarts consistently.
- π Release bookkeeping
- Updates
CHANGELOG.mdand bumps plugin version to0.1.45.
- Updates
π― Purpose & Impact
- β
Fewer crashes for end users (especially iOS)
- Apps no longer hard-crash if a user denies camera permission or if the camera is unavailable. Instead, setup fails gracefully with logs π΅β‘οΈπ
- β
More stable real-time inference on Android
- Prevents intermittent crashes when leaving screens, disposing the view, or stopping inference while frames are still arriving π§―
- β
Smoother navigation and lifecycle behavior
- Returning to a camera screen is less likely to result in a βstuckβ or non-restarting camera thanks to lifecycle ordering + restart support ππ·
- β
Developer-facing improvement
- The new
restartCamera()hook provides a simple recovery path if the camera needs to be restarted from Flutter (e.g., after permissions change) π οΈ
- The new
What's Changed
- fix: ios crash camera permissions by @asabri97 in https://github.com/ultralytics/yolo-flutter-app/pull/426
Full Changelog: https://github.com/ultralytics/yolo-flutter-app/compare/v0.1.43...v0.1.45