【问题标题】:WL.JSONStore.init(data_collection) is not working in IBM Worklight 6.0.0 hybrid applicationWL.JSONStore.init(data_collection) 在 IBM Worklight 6.0.0 混合应用程序中不起作用
【发布时间】:2015-07-10 03:02:02
【问题描述】:

我们尝试使用 IBM Worklight 开发一个简单的 Angular 混合应用程序,并且希望在我们的应用程序中使用 JSONStore。根据 Worklight 文档,我们在 application-descriptor.xml 文件中的其他资源下添加了 JSONStore,并在代码中创建了简单集合,如下所示。

var data_collection = {         
    people : {          
        searchFields : {name: 'string', age: 'integer'}  
    }
};

var promise = WL.JSONStore.init(data_collection).then(function(){
    alert("init json store successfully!");     
    return true;        
}).fail(function (errorObject) {            
    alert("init json store failed!" + errorObject);             
    return false;       
});

return promise; 

}; 

但是这段代码对我们不起作用。它在 WL.JSONStore.init 方法本身失败。请在这方面帮助我们。

【问题讨论】:

  • 提供日志查看异常情况。
  • 除了提供日志之外的其他一个完整的sn-p你的代码。在您提供的 sn-p 中有一个额外的 }。看起来它是函数的一部分。另外,您在alert("init json store failed!" + errorObject); 中遇到了什么错误
  • 您对这个问题有任何更新吗?如果您能够解决您的问题,请将您的解决方案作为问题的答案发布。

标签: ibm-mobilefirst jsonstore


【解决方案1】:

正如 Yoel 在 cmets 中提到的,错误的唯一证据似乎来自末尾的额外 }。

在 Android 环境中按原样使用您的代码并在 Worklight 6.2.0.01(因为您提到“worklight”)中对其进行测试,从而产生了成功的 JSONStore init。

您需要编辑您的问题:错误消息、测试的位置(环境、设备/模拟器/模拟器)、worklight 版本等...如果您想进一步解决这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-06
    • 1970-01-01
    • 1970-01-01
    • 2016-07-24
    • 2023-03-14
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多