Skip to content

iOS: Camera black screen when using image_picker on a screen_protector secured window (regression in 1.5.1) #62

Description

@thato-codes-4-fun

Environment

  • screen_protector: 1.5.1
  • image_picker (system UIImagePickerController)
  • iOS only (Android unaffected)
  • Flutter

Summary

After updating screen_protector to 1.5.1, opening the camera via image_picker
results in a black screen and the flow cannot complete. The app freezes and no
photo is captured.

Reproduction condition

This only occurs when screenshot protection is actively enabled. It did NOT
reproduce in our QA environment because protection was disabled there — making
it a production-only failure that is easy to miss in testing.

Root cause (investigated)

The 1.5.1 refactor to an overlay-based implementation (away from the previous
hack-based approach), combined with the UIScene lifecycle changes in 1.4.10 and
the window recreation in 1.4.8, puts the app window into a secured state that
UIImagePickerController cannot handle.

AVFoundation logs showed:

  • FigXPCUtilities / FigCaptureSourceRemote errors
  • Portrait/device mode issues
  • Invalid frame dimensions

Notably, even temporarily disabling protection immediately before opening the
camera did not resolve it — the window state was already corrupted.

Workaround

Replaced image_picker with the camera package (AVCaptureSession + custom UI)
for iOS production builds. This bypasses UIImagePickerController entirely and
is not affected by the secured window state.

Related

Similar black screen regression reported in #61 (triggered by returning from
external link rather than opening camera — likely the same underlying cause).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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