Created
February 20, 2020 08:57
-
-
Save oxlb/a4fa9a111ab7b060cafd3f531324e77a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @UIApplicationMain | |
| class AppDelegate: UIResponder, UIApplicationDelegate, AppsFlyerTrackerDelegate{ | |
| // ... | |
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
| // Override point for customization after application launch. | |
| AppsFlyerTracker.shared().appsFlyerDevKey = "repLaceWithYourDevKeY" | |
| AppsFlyerTracker.shared().appleAppID = "123456789" | |
| // ... | |
| AppsFlyerTracker.shared().delegate = self | |
| } | |
| func onConversionDataSuccess(_ installData: [AnyHashable: Any]) { | |
| //Handle Conversion Data (Deferred Deep Link) | |
| } | |
| func onConversionDataFail(_ error: Error?) { | |
| // print("\(error)") | |
| } | |
| func onAppOpenAttribution(_ attributionData: [AnyHashable: Any]) { | |
| //Handle Deep Link Data | |
| } | |
| func onAppOpenAttributionFailure(_ error: Error?) { | |
| } | |
| // Reports app open from a Universal Link for iOS 9 or later | |
| func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool { | |
| AppsFlyerTracker.shared().continue(userActivity, restorationHandler: restorationHandler) | |
| return true | |
| } | |
| // Reports app open from deep link from apps which do not support Universal Links (Twitter) and for iOS8 and below | |
| func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { | |
| AppsFlyerTracker.shared().handleOpen(url, sourceApplication: sourceApplication, withAnnotation: annotation) | |
| return true | |
| } | |
| // Reports app open from deep link for iOS 10 or later | |
| func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { | |
| AppsFlyerTracker.shared().handleOpen(url, options: options) | |
| return true | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment