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
Segment auto tracked lifecycles events do not function with the SwiftUI lifecycle. Segment initialization requires UIApplication be valid to set up notification observers of global events such as: UIApplicationWillEnterForegroundNotification.
UIApplication instance is not available on init of SwiftUI lifecycle @main. To workaround this, the app delegate adaptor for UIKit lifecycle hooks must be implemented and Segment must be initialized in applicationDidFinishLaunching.
This is not documented by Segment and can easily go unnoticed until it is realized that the auto tracked lifecycle events are not being fired.
My suggestion is that Segment not require UIApplication to be valid for setting up notification observers of global events for auto tracked lifecycle events.
The text was updated successfully, but these errors were encountered:
I would also comment that this is more than just an minor documentation issue, since it is very likely that the app will be doing things during App initialization (like identifying the user) that requires that Segment has already been initialized. So if we have to wait for AppDelete didFinishLaunching to initialize Segment, then those attempts to do anything will crash.
We ended up just doing our own lifecycle tracking and turned off Segment's for now.
Platform:
iOS + tvOS
Problem:
Segment auto tracked lifecycles events do not function with the SwiftUI lifecycle. Segment initialization requires
UIApplication
be valid to set up notification observers of global events such as:UIApplicationWillEnterForegroundNotification
.UIApplication
instance is not available oninit
of SwiftUI lifecycle@main
. To workaround this, the app delegate adaptor for UIKit lifecycle hooks must be implemented and Segment must be initialized inapplicationDidFinishLaunching
.This is not documented by Segment and can easily go unnoticed until it is realized that the auto tracked lifecycle events are not being fired.
My suggestion is that Segment not require
UIApplication
to be valid for setting up notification observers of global events for auto tracked lifecycle events.The text was updated successfully, but these errors were encountered: