countly-sdk-ios
countly-sdk-ios copied to clipboard
Log events to Countly from App Extension
Expected Behavior
I expect to be able to add the Countly SDK to an App Extension target (E.g. Siri Intents) and log events to Countly.
Current Behavior
When trying to add the Countly SDK, I encounter multiple errors related to the use of sharedApplication
:
'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
Screenshots (if appropriate):
Possible Solution
Most of these are wrapped in #if TARGET_OS_IOS
preprocessor directives. Is it possible to identify when the target is an app extension?
Steps to Reproduce (for bugs)
- Create an app extension
- Add the Countly SDK to it
More Description
We are trying to add analytics to our various Siri Intents to get an idea of how many customers actually use them.
Your Environment
- Countly iOS SDK version: 19.02
- Your iOS version: 13.1
- Any changes you have made to this SDK: none
👍 Any news about this issue? I also need tu send events from several extensions. Action Extension, Credential Provider Extension ...
Work in progress. Thanks.
Any updates on this? We need to use it in an extension as well.
Same, an update of the progress made since Jan would be appreciated. Extensions are the primary point of access to our app, so not having Countly working in the extension effectively causes us to miss most activity. I'm sure this is not a unique situation for us, especially given the prevalence of widgets.
From a naive look into the situation, it seems most access to UIApplication.shared can be simply disabled.
The best way to make a singular API that works for both App Extensions and Apps is to have two start
methods; one that takes a UIApplication?
parameter and one that takes a UIViewController
. open(url)
is accessible through the UIViewController
's extensionContext
.
Sorry, this one was left behind due to internal complexities and other prioritizations. This year plan to focus on this more.
Thank you for your understanding.
What's the state of using Countly in app extension targets? I tried using it by calling start
and recordEvent
but nothing gets logged. After digging through the code it seems events are batched locally and sent if UIApplication goes to background or is terminated. I don't think either of these happen in extension targets as there isn't an UIApplication. Is there anything that I am missing?
Hello, this SDK still does not support integration in App Extensions.