iOS Swift Realm加密和服务器同步

时间:2017-05-22 05:31:20

标签: ios swift realm

我将此配置代码用于 Realm Encryption

let configuration = Realm.Configuration(encryptionKey: "key" as Data)

let realm = try! Realm(configuration: configuration)

我将此配置代码用于 Realm Sync with server

let configuration = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL))

let realm = try! Realm(configuration: configuration)

我们如何使用Realm进行加密和与服务器同步?

1 个答案:

答案 0 :(得分:2)

Realm.Configuration initializer can accept multiple arguments如果您想指定配置的多个方面:

let config = Realm.Configuration(syncConfiguration: SyncConfiguration(user: user, realmURL: syncServerURL),
                                 encryptionKey: theKey)