-
Notifications
You must be signed in to change notification settings - Fork 94
Closed
Description
Describe the bug
After starting the client, I expect the client to be online. If I check the status of the client inside of its completion block, it says we are online. However, if I immediately check my variation, I get the fallback value.
To reproduce
This behavior is reproducible when there is no cache, ie the first run.
func testLD() {
let config = LDConfig(mobileKey: "test")
let user = LDUser(key: "test")
LDClient.shared.start(config: config, user: user) {
if LDClient.shared.isOnline {
let variation = LDClient.shared.variation(forKey: "key", fallback: "fallback")
print("variation: \(variation)") // prints "variation: fallback"
}
}
// If I run this method after calling start and then try
// accessing my variation inside of the callback, I get the actual value
LDClient.shared.setOnline(true) {
let variation = LDClient.shared.variation(forKey: "key", fallback: "fallback")
print("variation: \(variation)") // prints "variation: on"
}
}Expected behavior
Accessing variation after starting the client should work if we are online.
Logs
N/A
SDK version
4.1.0
Language version, developer tools
N/A
OS/platform
iOS
Additional context
N/A
Metadata
Metadata
Assignees
Labels
No labels