Capacitor - Trying to catch the cancel on camera

人走茶凉 提交于 2020-05-15 08:08:51

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/52352608/capacitor-trying-to-catch-the-cancel-on-camera

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!