Closed sonisan closed 1 year ago
Fixed in this PR https://github.com/realm/realm-swift/issues/8029
Hi @dianaafanador3 Are we sure this is fixed? I am using AutoOpen like so:
@AutoOpen(
appId: AtlasClient.shared.appId,
timeout: 5000) var autoOpen
@State var user: RealmSwift.User
let onboardData: OnboardData?
@Environment(\.realmConfiguration) private var config
var body: some View {
switch autoOpen {
case .connecting:
LoadingScreen()
case .waitingForUser:
LoadingScreen()
case .open(let realm):
RootContainer(shopper: {
if realm.objects(Shopper.self).count == 0 {
try! realm.write {
let newShopper = Shopper()
// newShopper.firebaseUserId = FirebaseClient.shared.currentUserId()!
realm.add(newShopper)
}
}
return realm.objects(Shopper.self).first!
}()).environment(\.realm, realm)
case .progress(let progress):
LoadingScreen()
case .error(let error):
ErrorScreenView()
.onAppear {
ErrorLoggingService.shared.recordError(error)
print("Error", error)
}
}
}
But when I go offline I get the error "Failed to connect to sync. Host not found (authoritative)"
I am also getting this error still did you ever find a work around??
Hi @dianaafanador3 Are we sure this is fixed? I am using AutoOpen like so:
@AutoOpen( appId: AtlasClient.shared.appId, timeout: 5000) var autoOpen @State var user: RealmSwift.User let onboardData: OnboardData? @Environment(\.realmConfiguration) private var config var body: some View { switch autoOpen { case .connecting: LoadingScreen() case .waitingForUser: LoadingScreen() case .open(let realm): RootContainer(shopper: { if realm.objects(Shopper.self).count == 0 { try! realm.write { let newShopper = Shopper() // newShopper.firebaseUserId = FirebaseClient.shared.currentUserId()! realm.add(newShopper) } } return realm.objects(Shopper.self).first! }()).environment(\.realm, realm) case .progress(let progress): LoadingScreen() case .error(let error): ErrorScreenView() .onAppear { ErrorLoggingService.shared.recordError(error) print("Error", error) } } }
But when I go offline I get the error "Failed to connect to sync. Host not found (authoritative)"
How frequently does the bug occur?
All the time
Description
I have been trying to use the
@AutoOpen
property wrapper to open a realm with a flexible sync configuration during the app initialisation. If the device is offline, the realm is blocked in.connecting
state and is never opened. It is working as intended if the device is online.Stacktrace & log output
Can you reproduce the bug?
Yes, always
Reproduction Steps
Version
Realm 10.31.0
What SDK flavour are you using?
MongoDB Realm (i.e. Sync, auth, functions)
Are you using encryption?
No, not using encryption
Platform OS and version(s)
macOS 12.6
Build environment
Xcode version: 14.0 Dependency manager and version: ...