尝试初始化时出现 SIGABRT 错误 iOS AppsFlyer SDK

SIGABRT Error When Trying to Initialization iOS AppsFlyer SDK

我正在尝试 运行 AppsFlyer SDK 的初始化,但我在应用程序启动时收到线程 1:信号 SIGABRT 错误。我在这里使用 AppsFlyer 的指南:https://support.appsflyer.com/hc/en-us/articles/207032066-AppsFlyer-SDK-Integration-iOS#3-sdk-initialization

我在 swift ios 10 的 swift 应用程序上使用它。我在指南中使用了 cocopods 选项。我尝试使用指南提供的确切代码,但没有用。然后,我尝试遵循 Xcode 建议的更改。这给了我一个警告,然后应用程序在启动时崩溃了。

指南说要使用的代码:

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

Xcode 建议固定代码:(错误:"Cannot assign value of type 'AppDelegate' to type 'AppsFlyerTrackerDelegate?'")

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

启动后出错:线程 1:信号 SIGABRT

我正在尝试让 SDK 初始化。

我也在使用 AdMob/Firebase 并且也在使用 cocopods。它按预期工作。

我可以通过将 AppsFlyerTracker.shared().delegate = self 更改为 AppsFlyerTracker.shared()?.delegate = self as? AppsFlyerTrackerDelegate 来修复错误。