簡體   English   中英

JSON 存儲設置密碼時無法讀取

[英]JSON Store can't read when setting password

我使用密碼打開集合,如下所示:

let options = JSONStoreOpenOptions()
            options.username = username
            options.password = paz
          do {
              try JSONStore.sharedInstance().openCollections([store], with: options)
          } catch let error as NSError {
            print(error)
          }

當我使用 Id 鍵找到時,無法解碼 JSON 返回並且我得到錯誤域 = JSON_STORE_EXCEPTION 代碼 = 22“(空)”。 我在沒有密碼的情況下測試了打開收藏,效果很好。

 let decoder = JSONDecoder()
        do {
               if let results = try store.find(withIds: [1], andOptions: nil) as? [[String: Any]],
                let result: [String: Any] = results.first,
                let json: [String: Any] = result["json"] as? [String: Any] {
                let jsonData = try JSONSerialization.data(withJSONObject: json, options: [])
                return try decoder.decode(type, from: jsonData)
            }
        } catch let error {
            print(error)
        }

使用密碼有什么我錯過的嗎?

我解決了這個問題。 這是因為SQLCipher和sqlite都安裝在項目中。如果SQLCipher和sqlite都安裝了,需要在SQLCipher后面的OTHER_FLCipher中設置Z786D348E95448121DC5B7387E22E4FFFAGS.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM