android - Worklight 6.1 JSONStore 调用 WL.JSONStore.init 在 Android 中挂起

标签 android ibm-mobilefirst init jsonstore

我在 Android 中的 JSONStore 初始化函数中遇到问题。它会挂起大约 10 分钟,直到 JSONStore 给我初始结果回调。这确实只发生在 Android 和 iPhone 工作正常。我可以给出重现过程:

  1. 将我的应用程序安装到之前未安装该应用程序的“干净”Android 设备中。
  2. 通过我的争论成功初始化了 JSONStore(我将在下面附上代码)。
  3. 然后我重新安装我的应用程序,请注意我没有卸载它,只是用新版本替换它。
  4. 替换后,我使用相同的身份验证尝试初始化 JSONStore,但它挂起....(可能会在 10 分钟或更长时间后给出结果回调,不会触发错误处理程序)。
  5. 如果终止应用程序并重新启动它,那么这次 JSONStore 初始化速度非常快并且工作正常

我用 inspect 调试应用程序,我确定这是 WL.JSONStore.init 没有给我挂起应用程序的结果回调的问题。我不知道为什么第一次需要消耗这么多时间。有没有人遇到和我一样的问题?

var options = {password:pscd,localKeyGen:true};
var promise = 
WL.JSONStore.init(data_collection, options).then(function(){
    console.info("init json store successfully!");
    return true;
}).fail(function (errorObject) {
    console.info("init json store failed!" + errorObject);
    return false;
});
return promise;

最佳答案

我刚刚在您拥有的同一个 6.1 版本中尝试了以下代码,它在 Android Emulator 和 Nexus 4 上都运行良好:

    var data_collection = {people : {
        searchFields : {name : 'string', age : 'integer'}
        }
    };
    var pscd = "samplepassword";
    var options = {password:pscd,localKeyGen:true};
    var promise = 
    WL.JSONStore.init(data_collection, options).then(function(){
        alert("init json store successfully!");
        return true;
    }).fail(function (errorObject) {
        alert("init json store failed!" + errorObject);
        return false;
    });
    return promise;

唯一可能与您的代码不同的是您的密码或 data_collection 变量。您能否添加有关 data_collection 是什么的更多详细信息?

关于android - Worklight 6.1 JSONStore 调用 WL.JSONStore.init 在 Android 中挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25799909/

相关文章:

python - 在 __init__() 中不创建对象的最佳方法是什么

android - 无法调用android中的onbackup方法

android - Android 字符串到图像的转换

ssl - worklight可以使用IE证书吗

mysql - 在 Worklight 平台或项目错误中找不到 com.mysql.jdbc.Driver

python - 如何模拟 '__init__'方法调用的方法

android - 运行 Android Studio 项目时出现 DX 错误

android - alchemy 的 REST API POST 调用是什么?

android - 将 native 应用程序与 Worklight 项目相结合

c - 8051F312微 Controller