launchdarkly / ios-client-sdk

LaunchDarkly Client-side SDK for iOS (Swift and Obj-C)
https://docs.launchdarkly.com/sdk/client-side/ios
Other
70 stars 84 forks source link

Secondary Environments do not Receive Delegate calls #170

Closed mickeyreiss closed 5 years ago

mickeyreiss commented 5 years ago

Is it possible to receive delegate callbacks on secondary environments? Looks like only the primary environment supports live updates.

markpokornycos commented 5 years ago

@mickeyreiss Thank you for your question about receiving delegate callbacks on Secondary Environments. The primary and secondary environments both can register delegates.

The primary environment works through the LDClient to provide backwards compatibility to clients not using the ME capabilities. As such, you can continue to use these methods as you could prior to 2.14.0.

With 2.14.0 and later, you can register delegates on the LDClientInterface object vended by +[LDClient environmentForMobileKeyNamed:]. If you pass the key kLDPrimaryEnvironmentName to that method, the vended object operates on the primary environment. If you pass your client defined environment name (registered in LDConfig) the vended object operates on the secondary environment. Therefore you can register a delegate for each environment (primary and secondary), and once done the SDK should notify the appropriate delegate. These can be the same or different objects conforming to ClientDelegate.

We are looking at the documentation associated with this issue to see if we can improve it.

mickeyreiss commented 5 years ago

Thanks for the thorough explanation.