【问题标题】:WL.JsonStore is not initialized, When trying to build the cordova IBM Mobile First Application in Android devices and In Android EmulatorWL.JsonStore 未初始化,尝试在 Android 设备和 Android 模拟器中构建 cordova IBM Mobile First 应用程序时
【发布时间】:2019-08-31 11:51:55
【问题描述】:

我点击了以下链接

https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/application-development/jsonstore/cordova/#adding-jsonstore

我还添加了 JsonStore 插件

尝试初始化 Cordova Mobile First 应用程序时未初始化 Wl.jsonStore

 WL.JSONStore.init(collections).then(function (collections) {                
    alert("collections creted sucessfully");
     console.log("Collections created sucessfully");
    // handle success - collection.people (people's collection)
                                            }).fail(function 
    (error) {
alert(error);
     console.log(error);// handle failure                                       });

WL.Store 需要初始化。 Kinldy 帮我解决这个问题。

【问题讨论】:

  • 您能否添加更重要的代码 sn-p 显示集合对象的完整初始化。错误似乎是由 wlCOmmonInit 引起的 - 你能分享完整的 wlCommonInit 函数吗
  • 是的,请检查下面的代码 var Messages = {}; var wlInitOptions = {}; var collectionName = '人';变种集合 = {};变种选项 = {};收藏[收藏名称] = {}; collections[collectionName].searchFields = {name: 'string', age: 'integer'}; function wlCommonInit() { WL.JSONStore.init(collections).then(function () { alert("集合创建成功"); console.log("集合创建成功"); }).fail(function (error) { alert(error); console.log(error); // 处理失败 }); loginApp.init(); }

标签: javascript ibm-mobilefirst jsonstore


【解决方案1】:

最后,我在 IBM TroubleShoot Site 找到了答案

请参考链接:

https://mobilefirstplatform.ibmcloud.com/tutorials/ru/foundation/8.0/troubleshooting/jsonstore/

在 config.xml 中,将 clientCustomInit 属性更改为 true。 在 index.js 文件中: 在文件开头添加以下行:

document.addEventListener('mfpjsonjsloaded', initWL, false);

在 wlCommonInit() 中保留 WL.JSONStore.init 调用

添加如下函数:

function initWL(){                                                     
  var options = typeof wlInitOptions !== 'undefined' ? wlInitOptions
  : {};                                                                
  WL.Client.init(options);                                           
}   

【讨论】:

    猜你喜欢
    • 2020-10-31
    • 2018-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多