我无法在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);
答案 0 :(得分:0)
你见过这些资源吗?他们有点老了,但仍然可以帮助你解决问题:
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尝试使用更新的插件,看看你是否还遇到了同样的问题。