You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an app with a Safari extension and it can't access any LaunchDarkly feature flag values. Safari extensions don't have network access and the SDK is caching flags in a custom user default suite that is inaccessible from app extensions. This is non-configurable from what I can tell (this protocol and implementation is internal):
There should be some way to configure this UserDefaults suite to point to the app group ID so extensions can also read from the defaults.
Am I overlooking something? How can I access cached LD flags from extensions that don't have network access?
To reproduce
Create an iOS app that has a main app target and a Safari extension.
Set up the LDClient in both the main app and the extension.
Launch the main app and log the allFlags value from the client.
Launch the Safari extension target and log the allFlags value from the client.
Observe that the Safari extension doesn't have any of the fetched or cached flag values from the main app target—it only has the default fallback values.
Expected behavior
Flag values fetched from the main app should be cached in such a way that extension targets can also access the cached values.
SDK version
9.0.0
Language version, developer tools
Xcode 14.3.1
OS/platform
iOS 16.6
The text was updated successfully, but these errors were encountered:
Hello @jayhickey, thank you for reaching out. Currently, we do not have testing with the extension targets with the SDK, so we are not sure if will this work. It likely will take the engineers some time, but we will look into this and give you an update once we have more information.
Hello @jayhickey, thank you for reaching out. Currently, we do not have testing with the extension targets with the SDK, so we are not sure if will this work. It likely will take the engineers some time, but we will look into this and give you an update once we have more information.
Filed Internally as 212134.
Thanks for the reply and for filing an internal ticket. I can tell you confidently that this does not work because you are storing the cached flag data in UserDefaults in a way that makes them inaccessible from extensions (see my code pointers above.) You will need to make the UserDefaults suiteName configurable, but that's a bit tricky since it looks like you are creating multiple UserDefaults databases, one for each mobileKey.
As a new LaunchDarkly customer I'm pretty shocked to see this isn't supported and hasn't come up in the past, pretty much every app has extensions these days 😃 This makes it impossible to use LaunchDarkly out of the box in Widgets, Content Blockers, Safari extensions, iMessage extensions, Keyboards extensions, Spotlight, and literally everything else listed here: https://developer.apple.com/app-extensions/
If you have an ability to do so, please prioritize this! Thank you 🙏
Describe the bug
I have an app with a Safari extension and it can't access any LaunchDarkly feature flag values. Safari extensions don't have network access and the SDK is caching flags in a custom user default suite that is inaccessible from app extensions. This is non-configurable from what I can tell (this protocol and implementation is
internal
):ios-client-sdk/LaunchDarkly/LaunchDarkly/ServiceObjects/Cache/FeatureFlagCache.swift
Line 23 in cb42f92
ios-client-sdk/LaunchDarkly/LaunchDarkly/ServiceObjects/ClientServiceFactory.swift
Lines 28 to 30 in cb42f92
There should be some way to configure this UserDefaults suite to point to the app group ID so extensions can also read from the defaults.
Am I overlooking something? How can I access cached LD flags from extensions that don't have network access?
To reproduce
allFlags
value from the client.allFlags
value from the client.Expected behavior
Flag values fetched from the main app should be cached in such a way that extension targets can also access the cached values.
SDK version
9.0.0
Language version, developer tools
Xcode 14.3.1
OS/platform
iOS 16.6
The text was updated successfully, but these errors were encountered: