我正在开发一个项目,该项目需要IBM MobileFirst作为应用程序的一个组成部分,因此,尝试调用函数Wl.send()
,以建立与数据库的连接,但似乎在新的cordova-plugin-mfp
中它已被弃用,
请建议我替换此函数或此函数的新调用过程。
这是我的MobileFirst Veriosn 8.0的离子信息和插件详细信息
@ionic/cli-utils : 1.10.2
ionic (Ionic CLI) : 3.10.3
本地包裹:
@ionic/app-scripts : 2.1.4
Ionic Framework : ionic-angular 3.6.1
系统:
Node : v6.10.3
npm : 3.10.10
OS : Windows 8.1
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.6 "Device"
cordova-plugin-dialogs 1.3.3 "Notification"
cordova-plugin-globalization 1.0.7 "Globalization"
cordova-plugin-mfp 8.0.2017090705 "IBM MobileFirst Platform Foundation"
cordova-plugin-mfp-push 8.0.2017082110 "IBM MobileFirst Platform Foundation - Push Notifications"
cordova-plugin-okhttp 2.0.0 "OkHttp"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"
以下是我们用于连接数据库的代码
var resourceRequest = new WLResourceRequest("adapters/SQLAdapter/unprotected", WLResourceRequest.GET);
console.log(resourceRequest);
resourceRequest.send().then((response) => {
console.log("Here I am in...");
console.log(response.responseText);
},(error) => {
console.log("error in function:-");
console.log(error);
});
代码中的错误是: -
Error:--- ERROR TypeError: Cannot read property 'getItem' of undefined at __WLDAO.getItem (ibmmfpf-preview.js:8285) at getItemFromMap () –
答案 0 :(得分:0)
MobileFirst 8.0中的新调用过程
要调用此过程,您必须使用 WLResourceRequest 和 resourceRequest.send()。
例如:
var resourceRequest = new WLResourceRequest(
"/adapters/JavaAdapter/users",
WLResourceRequest.GET
);
var formParams = {"param1": "value1", "param2": "value2"};
resourceRequest.sendFormParameters(formParams);
resourceRequest.send().then(
onSuccess,
onFailure
)
我建议你参观Cordova的MobileFirst Foundation Development或基于离子的应用程序。见这里:
在基于Ionic的应用中集成MobileFirst Foundation 8.0:https://mobilefirstplatform.ibmcloud.com/blog/2016/07/19/integrating-mobilefirst-foundation-8-in-ionic-based-apps/
将MobileFirst Foundation SDK添加到Cordova应用程序:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/sdk/cordova/
来自JavaScript(Cordova,Web)应用程序的资源请求:https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/resource-request/javascript/
答案 1 :(得分:0)
尝试降级cordova-plugin-mfp,然后尝试调用它,似乎他们还没有发布文件。我正在使用cordova-plugin-mfp
8.0.2017072706
尝试用它