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

相关问题