@gabrielconte14 wrote:
I’m trying to build an iOS Cordova plugin using Ionic and I’m having problems calling my javascript plugin functions
Error message: Property ‘Mtv’ does not exist on type ‘CordovaPlugins’
when it calls window.cordova.plugins.Mtv
I already tried calling cordova.plugins.Mtv, window.plugins.Mtv, window.Mtv, Mtv, cordova.Mtv and nothing seems to work.I already runned cordova plugin list in my project and my plugin is added correctly
My code in the ionic project:
import { Component, NgZone, OnInit} from '@angular/core'; declare var cordova: any; declare var Mtv: any; @Component({ selector: 'app-home', templateUrl: 'home.page.html', styleUrls: ['home.page.scss'], }) export class HomePage { constructor() { window.cordova.plugins.Mtv.provision("paysmart-ionic", "12456754", "12345656", "password", "email@email.com", this.handleProvisionResponse.bind(this)); } handleProvisionResponse (error, bundleObject) { ... } }In my plugin:
var Mtv = {}; Mtv.provision = function(tokenVaultID, cellPhone, userId, password, email, cb){ cordova.exec(function(result){ cb(null, result); }, cb, 'Mtv', 'provision', [tokenVaultID, cellPhone, userId, password, email]); }; module.exports = Mtv;
Posts: 1
Participants: 1