let syncServerURL = URL(string: serverUrl + "Combine")!
var configuration = Realm.Configuration()
configuration.encryptionKey = Utility().getKey() as Data
configuration.syncConfiguration = SyncConfiguration(user: SyncUser.current!, realmURL: syncServerURL)
Realm.asyncOpen(configuration: configuration, callback: { realm, error in
if let realm = realm {
let results = realm.objects(Combine.self)
} else if let error = error {
print("error ******* \(error)")
// Handle error that occurred while opening or downloading the contents of the Realm
}
})
我使用了asyncOpen方法配置来获取同步的Realms,响应结果与Realm服务器记录相同。
let syncServerURL = URL(string: serverUrl + "Combine")!
var configuration = Realm.Configuration()
configuration.encryptionKey = getKey() as Data
configuration.syncConfiguration = SyncConfiguration(user: current, realmURL: syncServerURL)
let realm = try! Realm(configuration: configuration)
let results = realm.objects(Combine.self)
我使用了这种方法配置来获取同步的领域,响应结果与领域服务器记录不一致。它显示不正确/过时的记录。
上述结果不同。