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)
我用得到同步領域,響應結果沒有顯示一樣的境界服務器記錄此方法配置。它顯示不正確/過時的記錄
上述結果是不同的