AppsFlyerSDK / AppsFlyerFramework

AppsFlyer Apple SDK
https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS
Other
166 stars 89 forks source link

SceneDelegate only apps, missing .start()? #139

Closed rromanchuk closed 1 year ago

rromanchuk commented 3 years ago

Shouldn't start() be added to sceneDidBecomeActive? func applicationDidBecomeActive(_ application: UIApplication) is NOOP in my case and missing from here https://support.appsflyer.com/hc/en-us/articles/207032066-iOS-SDK-V6-X-integration-guide-for-developers#integration

SDK setup seems to work when moving to scene delegate.

func sceneDidBecomeActive(_ scene: UIScene) {
  AppsFlyerLib.shared().start()
}
rromanchuk commented 3 years ago

https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622956-applicationdidbecomeactive

Warning

If you are using scenes (see Scenes), UIKit will not call this method. Use sceneDidBecomeActive(_:) instead to restart any tasks or refresh your app’s user interface. UIKit posts a didBecomeActiveNotification regardless of whether your app uses scenes.

freddy1h commented 3 years ago

I emailed their support team and they responded with this

So basically yes, when you use sceneDelegate, applicationDidBecomeActive is not called. However didBecomeActiveNotification is called. So what we suggest is to add an observer to this notification and when the notification is triggered, to call start. Why we suggest this rather than in sceneDelegate ? Because we want to keep the launch of the SK = launch of the app. And not the launch of a specific scene as there could be multiple scenes.