【问题标题】:IBM Worklight 6.0 - JSONStore error in preview after migrating from Worklight 5.0.6IBM Worklight 6.0 - 从 Worklight 5.0.6 迁移后预览中的 JSONStore 错误
【发布时间】:2013-07-18 01:05:16
【问题描述】:
我有一个在 v5.0.6 中使用 JSONStore 的应用程序。
我将项目迁移到 v6.0 并尝试使用移动浏览器模拟器来测试 JSONStore 功能。
我将WL.Client.getEnvironment() === 'preview' 添加到我的集合JavaScript 文件中的if 条件中。
但是,当我尝试获取集合的实例时,出现错误:
TypeError: WL.profileCollection 未定义
我认为这可能是因为版本 6 中不存在以下 API?
WL.namespace('WL.profileCollection');
解决这个问题的方法是什么?
【问题讨论】:
标签:
ibm-mobilefirst
jsonstore
worklight-console
worklight-mbs
【解决方案1】:
试试:
var WL = WL || {};
WL.profileCollection = WL.profileCollection || {};
//rest of your code
删除:WL.namespace('WL.profileCollection');
打开了一个缺陷以将WL.namespace 添加回代码,解决方法如上。
确保删除所有阻止代码执行的 if 语句:
if (WL.Client.getEnvironment() === 'android' && ...) { ... }
或确保将预览/公共环境添加到这些 if 语句中。在 Worklight 6.0 JSONStore 仅支持 Android 和 iOS 环境之前,这就是向导默认生成这些 if 语句的原因。借助 Worklight 6.0,有一个兼容的纯 JavaScript API 可用于更快地开发 JSONStore 应用程序。更多关于 IBM Information Center 内的新增功能部分。