Closed ugiacoman closed 5 years ago
Hi @ugiacoman, thanks for the report! isOnline
is a slightly deceptive name because it indicates connection status but not whether the SDK has received flag values. Your completion closure on setOnline
is called when flag values are received. I recommend using a completion closure on the start
method which is called after setOnline
is called and completed internally. This should allow your application to continue once flag values are received on startup including cold starts. If you have other questions or concerns please respond in this issue or reach out to support.
Hi @torchhound, I am experience issues similar to the original poster. After reading your comment are you recommending something like the following?
LDClient.shared.start(config: config, user: user) {
let variation = LDClient.shared.variation(forKey: "key", fallback: "fallback")
print("variation: \(variation)") // prints "variation: fallback"
}
The above solution consistently prints "fallback" for me. Is there a notification or closure in the SDK we should be using to know when it is safe to ask for variations from LDClient
aka as you put it "has received flag values"? Thank you!
Hi @lazyvar,
Thanks for reaching out! I see you also submitted a support request. This is more of a support issue, rather than an engineering issue. I'll help you via your support request shortly.
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.
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