katzer / cordova-plugin-email-composer

Edit and send email messages
Apache License 2.0
344 stars 333 forks source link

NOT_FOUND_ERR #304

Closed limoli closed 6 years ago

limoli commented 6 years ago

Expected behaviour

I expect that the method hasPermission() triggers the popup on iOS to allow that permission.

What happens

It seems that the permission is already granted, indeed the promise returns a granted value set to true.

However, the method open() throws the following exception:

ERROR: Exception opening email composer {"code":1,"message":"NOT_FOUND_ERR"}

Device

To test I am using a real device:

Code

this.emailComposer.hasPermission().then((granted: boolean) => {
    if (granted) {
        this.contactSupportViaEmail();
    } else {
        Logger.WriteError("Email composer has no permissions.");
    }
}).catch(err => {
    Logger.WriteError("Exception requesting mail permission", JSON.stringify(err));
});

async contactSupportViaEmail() {
    try {
        const email = {
            to: this.invoice.issuer.email,
            subject: 'Information about invoice',
            body: 'Generated by mInvoice',
            isHtml: true
        };
        await this.emailComposer.open(email);
    } catch (err) {
        Logger.WriteError("Exception opening email composer", JSON.stringify(err));
    }
}