0

我正在使用 Javascript JSONStore 在 IBM Mobile First Platform 8.0.0 中初始化 JsonStore 集合。我面临的问题是以下代码在某些设备上运行良好,而对于某些设备,它是否出现以下错误。

01-19 19:49:43.487 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.java:197 中的 JSONStoreLogger.logTrace :: 现有集合的表架构不匹配。01-19 19:49:43.492 11622-11646/com.mobiInspect D/JSONSTORE: JSONStoreLogger.logTrace 在 JSONStoreLogger.java:197 :: 调度动作“provision” 01-19 19:49:43.498 11622-11646/com.mobiInspect D/JSONSTORE:JSONStoreLogger.java:197 中的 JSONStoreLogger.logTrace :: 使用参数调用操作调度程序“provision”:01-19 19:49:43.501 11622-11646/com.mobiInspect D/JSONSTORE:JSONStoreLogger.java 中的 JSONStoreLogger.logTrace :197 :: dbName=inspectorList 01-19 19:49:43.505 11622-11622/com.mobiInspect D/WebView:evaluateJavascript=cordova.callbackFromNative('LoggerPlugin1661877744',true,1,["OK"],false); 01-19 19:49:43.506 11622-11646/com。768 11622-11646/com.mobiInspect D/wl.response:WLResponse。在 WLResponse.java:69 :: Response 中不包含 Content-Encoding 标头。试图读取响应正文。01-19 19:49:43.814 11622-11646/com.mobiInspect D/wl.request: WLRequestSender.run in WLRequestSender.java:43 :: 发送请求https://www.serverurl.com/mfp/api/az/v1/token

$scope.init_collection = function () {
    ProgressIndicator.showSimpleWithLabel(false, 'Loading...');

    //Data Collection

    collections1['COLLECTION_NAME'] = {
        searchFields: {'id': 'string', 'processid': 'string', 'state': 'integer'}
    };

    WL.JSONStore.init(collections1, options)
    .then(function () {
        WL.Logger.info("Inside Task Submission Collection");

        WL.JSONStore.fileInfo()
                                .then(function (res) {
                                WL.Logger.debug(" Success response of Task Submission Collection fileInfo :" +JSON.stringify(res));
                                  //res => [{isEncrypted : true, name : carlos, size : 3072}]
                                })

                                  .fail(function (failRes) {
                                  WL.Logger.debug("Failure response of Task Submission Collection fileInfo :" +JSON.stringify(failRes));
                                  // Handle failure.
                                });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_DTA_STRG);
        WL.Logger.error("Initialization failure on : Task Submission Collection "+JSON.stringify(errorObject));
    });
    //WL.Logger.info(Messages.INF_LGN_INI_DTA_STRG);
    //Data Collection

    //Image Collection

    collections2["COLLECTION_IMAGE"] = {
        searchFields: {'id': 'string', 'processid': 'string', 'isImageSubmitted': 'boolean'}
    };

    WL.JSONStore.init(collections2, options)
    .then(function () {
        WL.Logger.info("Inside Image Submission Collection");

        WL.JSONStore.fileInfo()
                                    .then(function (res) {
                                    WL.Logger.debug(" Success response of Image Submission Collection fileInfo :" +JSON.stringify(res));
                                      //res => [{isEncrypted : true, name : carlos, size : 3072}]
                                    })

                                      .fail(function (failRes) {
                                      WL.Logger.debug("Failure response of Image Submission Collection fileInfo :" +JSON.stringify(failRes));
                                      // Handle failure.
                                    });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_IMG_CLL);
        WL.Logger.error("Initialization failure on : Image Submission Collection "+JSON.stringify(errorObject));
    });
    //WL.Logger.info(Messages.INF_LGN_CLL_INI);

    //Image Collection


    //TODAY Collection

    collections3["COLLECTION_TODAY"] = {
        searchFields: {'id': 'string', 'processid': 'string', 'state': 'integer', 'insname': 'string'}
    };
    WL.JSONStore.init(collections3, options)
    .then(function () {
        WL.Logger.info("Inside Task List Collection");

        WL.JSONStore.fileInfo()
        .then(function (res) {
            WL.Logger.debug("Success response of Task List Collection fileInfo :" +JSON.stringify(res));
                                      //res => [{isEncrypted : true, name : carlos, size : 3072}]
        })
        .fail(function (failRes) {
            WL.Logger.debug("Failure response of Task List Collection fileInfo :" +JSON.stringify(failRes));
            // Handle failure.
        });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_IMG_CLL);
        WL.Logger.error("Initialization failure on : Task List Collection "+JSON.stringify(errorObject));
    });
    //WL.Logger.info(Messages.INF_LGN_CLL_INI);

    //TODAY Collection

    //List Collection
    collections4["COLLECTION_LIST"] = {
        searchFields: {'name': 'string'}
    };
    WL.JSONStore.init(collections4, options)
    .then(function () {
        WL.Logger.info("Inside Inspector List Collection");

        WL.JSONStore.fileInfo()
        .then(function (res) {
            WL.Logger.debug("Success response of Inspector List Collection fileInfo :" +JSON.stringify(res));
                                      //res => [{isEncrypted : true, name : carlos, size : 3072}]
        })
        .fail(function (failRes) {
            WL.Logger.debug("Failure response of Inspector List Collection fileInfo :" +JSON.stringify(failRes));
            // Handle failure.
        });
    })
    .fail(function (errorObject) {
        //WL.Logger.error(Messages.ERR_LGN_FAIL_INI_IMG_CLL);
        WL.Logger.error("Initialization failure on : Inspector List Collection " +JSON.stringify(errorObject));
    });
    WL.Logger.info(Messages.INF_LGN_CLL_INI);
    //List Collection

};

我在这里错过了 IBM MFP 8.0 中 JsonStore 初始化的任何内容吗?任何帮助,将不胜感激。

4

1 回答 1

0

错误消息“PROVISION_TABLE_SEARCH_FIELDS_MISMATCH”可能发生在

搜索字段不是动态的。在调用带有新搜索字段的 init 或 open 方法之前,如果不调用 destroy 方法或 removeCollection 方法,则无法更改搜索字段。如果您更改搜索字段的名称或类型,可能会发生此错误。例如:{key: 'string'} 到 {key: 'number'} 或 {myKey: 'string'} 到 {theKey: 'string'}。

有关更多详细信息,请参见此处:http: //mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/troubleshooting/jsonstore/

于 2018-01-22T04:47:26.163 回答