3

我在離子2項目中使用第三方插件科爾多瓦其中一些不在本地離子可有麻煩。就我所關心的,Ionic Native之外的插件,我不需要導入它們。它們可以直接使用。如何使用科爾多瓦插件離子2

我使用ibm-mfp-corehttps://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); 

回答

1

你見過這些資源?他們是有點老,但仍可以幫助您解決問題:

https://developer.ibm.com/bluemix/2016/01/20/bluemix-mobile-client-access-services-in-ionic-apps/

https://www.youtube.com/watch?v=UObmJQtxixs

讓我知道,如果這些信息不能幫助。

更新

截至今日新bms-core plugin已經發布。我們一直在努力通過完全重新運用我們的cordova插件來改善cordova體驗。

@somnathbm嘗試使用更新後的插件,看看你是否仍遇到同樣的問題。

+0

感謝您回覆戴夫。不幸的是,你上面提到的那些資源並不能幫助我。那些過時並且不起作用。 我檢查了插件的'plugin.xml'文件。發現該插件沒有綁定到'cordova.plugins'集合。所以它應該可以直接訪問。但不是。 – somnathbm

相關問題