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)
동기화 된 영역을 얻으려면이 방법 구성을 사용했지만 응답 결과는 영역 서버 레코드와 동일하게 나타나지 않습니다. 그것 보여주는 잘못된/오래된 기록
위의 결과는 동기 생성자 즉시 로컬 영역 인스턴스를 반환하고 백그라운드에서 동기화하는 동안