3
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方法配置来获取同步的领域,响应结果显示为与领域服务器记录相同。Swift 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)
我用得到同步领域,响应结果没有显示一样的境界服务器记录此方法配置。它显示不正确/过时的记录
上述结果是不同的