apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
966 stars 1.55k forks source link

app crashes on iOS 16.x when app is minimized while camera is open #857

Open bilalsaeed opened 1 year ago

bilalsaeed commented 1 year ago

Bug Report ionic app crashes on iOS 16.x when app is minimized while camera is open

Problem

We are seeing weird problems in our ionic app for iOS. When we minimize the app while the camera was open, and open another app which accesses the camera our app crashes. We are only seeing this behaviour on iOS devices running 16.x+.

Our app crashes when we follow following steps:

  1. Access camera in your cordova app
  2. Minimize your app while the camera is open.
  3. Open "Camera" app or any other app that accesses the camera and capture photo
  4. Minimize the app you opened in 3rd step
  5. Reopen your app and it crashes

What is expected to happen?

When app minimizes it should close the camera,

What does actually happen?

App crashes.

Environment, Platform, Device

Tested on iPhone 12 (16.6.1), iPhone SE 2020 (16.1)

Version information

Latest version of cordova ios and android. camera plugin version: 6.0.0

Checklist

bilalsaeed commented 1 year ago

is it possible to just close the camera when app is minimize i.e., when platform is stopped?

thiagoroc commented 1 year ago

Bug Report ionic app crashes on iOS 16.x when app is minimized while camera is open

Problem

We are seeing weird problems in our ionic app for iOS. When we minimize the app while the camera was open, and open another app which accesses the camera our app crashes. We are only seeing this behaviour on iOS devices running 16.x+.

Our app crashes when we follow following steps:

  1. Access camera in your cordova app
  2. Minimize your app while the camera is open.
  3. Open "Camera" app or any other app that accesses the camera and capture photo
  4. Minimize the app you opened in 3rd step
  5. Reopen your app and it crashes

What is expected to happen?

When app minimizes it should close the camera,

What does actually happen?

App crashes.

Environment, Platform, Device

Tested on iPhone 12 (16.6.1), iPhone SE 2020 (16.1)

Version information

Latest version of cordova ios and android. camera plugin version: 6.0.0

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

I used background-mode plugin for correct this problem no Android. I think it works on IOS too.

bilalsaeed commented 1 year ago

Bug Report ionic app crashes on iOS 16.x when app is minimized while camera is open

Problem

We are seeing weird problems in our ionic app for iOS. When we minimize the app while the camera was open, and open another app which accesses the camera our app crashes. We are only seeing this behaviour on iOS devices running 16.x+. Our app crashes when we follow following steps:

  1. Access camera in your cordova app
  2. Minimize your app while the camera is open.
  3. Open "Camera" app or any other app that accesses the camera and capture photo
  4. Minimize the app you opened in 3rd step
  5. Reopen your app and it crashes

What is expected to happen?

When app minimizes it should close the camera,

What does actually happen?

App crashes.

Environment, Platform, Device

Tested on iPhone 12 (16.6.1), iPhone SE 2020 (16.1)

Version information

Latest version of cordova ios and android. camera plugin version: 6.0.0

Checklist

  • [x] I searched for existing GitHub issues
  • [x] I updated all Cordova tooling to most recent version
  • [x] I included all the necessary information above

I used background-mode plugin for correct this problem no Android. I think it works on IOS too.

Could you please let me know how did background-mode plugin solve the problem?

Thanks,

breautek commented 1 year ago

Are you able to provide a back trace or a stack trace? If this information isn't available, then the best way to move this forward is to provide a bare reproduction app using nothing but the cordova camera plugin and anything else required to reproduce the crash. It should not contain any frameworks which helps isolate the issue down to just Apache Cordova code.

Also are you sure that your app simply isn't closing because it's in the background? OS reserves the right to close background apps for variety of reasons, a common one is to provide more resources to the foreground app. In this case, then the app is terminated (not crashed) and will be restarted when the user returns to the app.