Search code examples
swiftappsflyer-ios-sdk

SIGABRT Error When Trying to Initialization iOS AppsFlyer SDK


I am trying to run the initialization of the AppsFlyer SDK, but I am getting a Thread 1: signal SIGABRT error when the app is launching. I am using the guide from AppsFlyer here: https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS#3-sdk-initialization.

I am using this on a swift ios app in Xcode 10. I used the cocopods option in the guide. I tried using the exact code that the guide provided, but that did not work. I then tried to follow the changes that Xcode sudgested. That gave me a warning and the app then crashed when launching.

The Code that The guide says to use:

AppsFlyerTracker.shared().appsFlyerDevKey = "<your-appsflyer-dev-key>";
AppsFlyerTracker.shared().appleAppID = "123456789"
AppsFlyerTracker.shared().delegate = self

Xcode sugested fixed code: (Error: "Cannot assign value of type 'AppDelegate' to type 'AppsFlyerTrackerDelegate?'")

AppsFlyerTracker.shared().appsFlyerDevKey = "xxxxxxxxx";
AppsFlyerTracker.shared().appleAppID = "xxxxxxxx"
AppsFlyerTracker.shared().delegate = self as! AppsFlyerTrackerDelegate

Error after launching: Thread 1: signal SIGABRT

I am trying to get the SDK to initialize.

I am also using AdMob/Firebase and that is also using cocopods. It is working as expected.


Solution

  • I was able to fix the error by changing AppsFlyerTracker.shared().delegate = self to AppsFlyerTracker.shared()?.delegate = self as? AppsFlyerTrackerDelegate.