3

I am using Capacitor with Ionic 4 and I would like to catch when the user taps on cancel when on the camera.

public async takePicture(): Promise<string> {

    const image: CameraPhoto = await Camera.getPhoto({
        quality: 90,
        allowEditing: true,
        correctOrientation: true,
        resultType: CameraResultType.Uri,
        source: CameraSource.Camera
    }).catch((e) => {
        throw new Error(e);
    });

    return this._IMAGE = image.webPath;
}

I am simply try to catch and error but clicking on cancel does not throw an error anymore when compared to cordova. How do I catch the cancel on a camera

Xerri
  • 4,916
  • 6
  • 45
  • 54

1 Answers1

3

Sorry, that was a bug, we weren't sending any error on photo cancel for iOS.

I've sent a PR to fix it, should be fine on next release

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176