3

Ionic 2 プロジェクトでサードパーティの cordova プラグインを使用する際に問題が発生していますが、その一部は Ionic Native では利用できません。私に関する限り、Ionic Native の外部にあるプラグインは、インポートする必要はありません。直接入手できます。

ibm-mfp-core( https://www.npmjs.com/package/ibm-mfp-core ) プラグインを使用しています。BMSClient.initialize()メソッドを使用して IBM Bluemix SDK を初期化したいだけです。さらに、他にもいくつかのビルトインがあります。しかし、それらのどれも では利用できませんcordova.plugins

スニペットは次のとおりです。

import { Component } from '@angular/core';
import { Platform, ionicBootstrap } from 'ionic-angular';
import { StatusBar } from 'ionic-native';
import { TabsPage } from './pages/tabs/tabs';

declare let cordova:any;

@Component({
  template: '<ion-nav [root]="rootPage"></ion-nav>'
})
export class MyApp {

  public rootPage: any;

  constructor(private platform: Platform) {
    this.rootPage = TabsPage;

    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();

      // initialize IBM BLuemix SDK
      //BMSClient.initialize("https://pearl.mybluemix.net", "1a1ab2e9-4f5a-4db6-9ba3-2da97349a160");

      typeof cordova.plugins.MFPCore != 'undefined'?alert('MFP found'):alert('MFP NOT found');
    });
  }
}

ionicBootstrap(MyApp);
4

1 に答える 1