iOS (Fabric): Crashlytics crashing app on launch

一个人想着一个人 提交于 2019-12-01 07:28:15

问题


I have updated the Crashlytics but still I am getting this error on launch:

Error: *** Terminating app due to uncaught exception 'FABException', reason: '[Fabric] It appears that "Crashlytics" is not a valid Fabric Kit. Please make sure you only pass Fabric Kits to [Fabric with:].'

Here is my code:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

         Fabric.with([Crashlytics.self])
         return true
    }

回答1:


I was having a crash on the same line, and it was because I called it BEFORE FirebaseApp.configure().

For anyone having the same issue, make sure you call them in this order:

FirebaseApp.configure()
Fabric.with([Crashlytics.self])



回答2:


After spending 7 hours, I am able to solve the problem. Problem is: there are 2 Crashlytics files are in my code which are causing this problem. To solve the problem, I have deleted the older file and again integrate the Crashlytics.




回答3:


Try this:-

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
      Fabric.with([Crashlytics.self])
      return true
    }



回答4:


Try below code snippet, it may help:

For Swift:

//import related frameworks

import Fabric

import Crashlytics

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {

    Fabric.with([Crashlytics()])
    //... your initialization code
    return true
}

For Objective-C:

#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
     [Fabric with:@[CrashlyticsKit]];
     //... your initialization code
   return YES;
}


来源:https://stackoverflow.com/questions/39716988/ios-fabric-crashlytics-crashing-app-on-launch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!