【问题标题】:iOS Swift Realm Encryption and Sync with serveriOS Swift Realm 加密和与服务器同步
【发布时间】:2017-05-23 03:54:27
【问题描述】:

我将这个配置代码用于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 进行加密和与服务器同步?

【问题讨论】:

    标签: ios swift realm


    【解决方案1】:

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

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

    【讨论】:

    • 感谢您的帮助。可以启用或禁用 SyncConfiguration 吗?。
    • 我不确定禁用配置意味着什么?
    • 在某些情况下,我只想将数据存储在本地而不同步到服务器?我如何做到这一点?
    • 创建和使用两个独立的配置,一个有同步配置,一个没有。
    • 考虑这种情况。假设我创建了一些没有同步的数据,它保存在本地。但是,如果我打开同步(不同的配置),之前创建的数据(本地)不会同步到服务器?如何同步已经保存的数据?感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    • 2019-01-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多