Per Apple's AVCaptureSession.h docs (line 1106), AVCapturePhotoOutput applies connection rotation via EXIF tags rather than physical pixel rotation. The macOS variants of `fileDataRepresentationWithCustomizer` and `fileDataRepresentationWithReplacementMetadata` are API_UNAVAILABLE(macos), so we can't replace the embedded EXIF through the standard customizer. Workaround: on macOS, grab the raw `AVCapturePhoto.cgImageRepresentation()` — Apple documents this as "the physical rotation of the CGImageRef matches that of the main image. Exif orientation has not been applied." — and re-encode the JPEG via `CGImageDestination` with no orientation metadata. Resulting JPEG has sensor-native landscape pixels and no EXIF Orientation tag; viewers and Flutter's image codec both display as landscape. iOS path unchanged (still uses fileDataRepresentation). Diagnostic now fires on both the success and failure branches of the delegate, so when the capture fails (e.g. the macOS "OSStatus error 13" the user observed) the failure reason — domain, code, localized description — is captured to banlu.jsonl instead of silently dropped.
7.7 KiB
7.7 KiB