2016-09-19 4 views
0

私のアプリケーションでJSONStoreを使用して、機密データを保存しています。コレクションを暗号化するには、下記のように、ユーザー名とパスワードのオプションを渡します。アンドロイドではこれまでのところうまく機能していましたが、iosデバイスではコレクションからデータを取得している間に空白のページが表示されています(シミュレータでうまく動作します)。私もエラーを取得していません.iosでオプションを渡さずに、そのうまく動作します。誰も似たような問題に直面していますか?Worklight JSONストアのコレクションの暗号化がiosで動作しない

factory('todoJsonStorage',['$q', function ($q) { 
'use strict'; 

var COLLECTION_NAME = 'Users'; 
var collections = { 
     Users: { 
      searchFields: {UserId: 'string', password: 'string'} 
     }, 
    }; 
var options = {}; 

//Optional username 
options.username = 'testuser'; 
//Optional password 
options.password = 'test123'; 

//Optional local key generation flag 
options.localKeyGen = true; 

var inited = false; 

//checks if inited and if not inits 
function initJSONStore(){ 
    var initDeferred = $q.defer(); 
    if (inited){ 
     initDeferred.resolve(); 
    } else { 
     //Initialize the collection 
     WL.JSONStore.init(collections,options).then(function() { 
      console.log("-> JSONStore init successful"); 
      initDeferred.resolve(); 
     }).fail(function (errorObject) { 
      console.log("-> JSONStore error: " + errorObject.msg); 
     }); 

     return initDeferred.promise; 
    }; 
} 

return { 
    get: function() { 
     var deferred = $q.defer(); 
     initJSONStore().then(function(){ 
      WL.JSONStore.get(COLLECTION_NAME).findAll().then(function (res) { 
       if (res.length > 0){ 
        deferred.resolve(JSON.parse(res[0].json.data || '[]')); 
       } else { 
         deferred.resolve(res);     
         } 

      }).fail(function (errorObject) { 
       console.log("JSONStore findbyid error: " + errorObject.msg); 
      }); 
     }); 
     return deferred.promise; 
    }, 

    put: function (todos) { 
     WL.JSONStore.get(COLLECTION_NAME).clear(); 
     WL.JSONStore.get(COLLECTION_NAME).add({data:JSON.stringify(todos)}); 
    } 
}; 

}]) 

答えて

0

iOS 10を使用している場合は、キーチェーン共有機能を有効にする必要があります。そうしないと、すぐに使用できなくなります。

+0

ありがとうございます。しかし、jsonストアを取得している間に空白のページを取得するだけでも、10未満のバージョンのiosをテストしました。 – Abinaya

+0

こんにちはIdan、iOSでパスワードオプションを渡している間、IBM 7.1.0.00-20151023-1441バージョンを使用しています。下記のエラーが発生しました。(console-via-logger.js、175行目) [ログ(175行目) [ログ] - > JSONStoreの初期化に成功(console-via-logger.js、175行目) [ログ] - > JSONStoreエラー:PROVISION_TABLE_SEARCH_FIELDS_MISMATCHコンソール経由logger.js、ライン175) JSONStore findbyidエラー[ログイン]を:PERSISTENT_STORE_NOT_OPEN(コンソール経由logger.js、ライン175) は – Abinaya

+0

がOのサポートができるようにPMRをオープンすること自由に感じなさい助けてください助けます。 –

関連する問題