Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bug: Camera crashes when screen orientation is locked in portrait + image is taken landscape #2892

Closed
1 of 4 tasks
seanharr11 opened this issue May 9, 2020 · 2 comments
Closed
1 of 4 tasks

Comments

@seanharr11
Copy link

seanharr11 commented May 9, 2020

Bug Report

Capacitor Version

npx cap doctor output:

Latest Dependencies:

  @capacitor/cli: 2.1.0

  @capacitor/core: 2.1.0

  @capacitor/android: 2.1.0

  @capacitor/electron: 2.1.0

  @capacitor/ios: 2.1.0

Installed Dependencies:

  @capacitor/electron not installed


  @capacitor/cli 2.1.0

  @capacitor/core 2.1.0

  @capacitor/android 2.1.0

  @capacitor/ios 2.1.0

[success] Android looking great! 👌
  Found 4 Capacitor plugins for ios:
    capacitor-secure-storage-plugin (0.3.2)
    cordova-open-native-settings (1.5.2)
    cordova-plugin-screen-orientation (3.0.2)
    es6-promise-plugin (4.2.2)
[success] iOS looking great! 👌

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

When the app is locked in portrait mode, and a picture is taken in landscape mode, or if taken in portrait mode and rotated to landscape mode, tapping "Use Photo" causes app to crash with:

TO JS {"exif":{"WhiteBalance":0,"LensModel":"iPhone X back dual camera 4mm f\/1.8","SubsecTimeOriginal":"511","Flash":24,"PixelYDimension":3024,"DateTimeOriginal":"2020:05:08 20:20:59","SensingMethod":2,"MeteringMode":5,"OffsetTimeDigitized":"-04:00","ExposureTi
2020-05-08 20:21:05.921025-0400 Notemeal[390:13076] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'preferredInterfaceOrientationForPresentation 'landscapeLeft' must match a supported interface orientation: 'portrait, portraitUpsideDown'!'

Expected Behavior

Photo should save w/o crashing the app!

Sample Code or Sample Application Repo

  import { ScreenOrientation } from '@ionic-native/screen-orientation';
  // ^ Make sure we have screen-orientation plugin installed

  window.screen.orientation.lock('portrait');
  const image = await Camera.getPhoto({
    quality: 20,
    allowEditing: false,
    saveToGallery: false,

    resultType: CameraResultType.Base64,
    source: CameraSource.Camera
  });

Reproduction Steps

  1. Lock your app's orientation with window.screen.orientation.lock('portrait');
  2. Take a picture
  3. Rotate camera to landscape
  4. Tap "Use Photo", (crash)

-OR-

  1. Lock your app's orientation with window.screen.orientation.lock('portrait');
  2. Take a picture in landscape mode
  3. Tap "Use Photo", (crash)

Other Technical Details

npm --version output: 6.9.0

node --version output: v12.3.1

pod --version output (iOS issues only): 1.8.4

@jcesarmobile
Copy link
Member

can you provide a sample app?

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 11, 2022
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants