Muhammad Umair
Muhammad Umair

Reputation: 593

iOS (Fabric): Crashlytics crashing app on launch

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
    }

Upvotes: 2

Views: 3626

Answers (4)

Kqtr
Kqtr

Reputation: 5935

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])

Upvotes: 5

Muhammad Umair
Muhammad Umair

Reputation: 593

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.

Upvotes: 2

Ronak Chaniyara
Ronak Chaniyara

Reputation: 5436

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;
}

Upvotes: 0

vibhor
vibhor

Reputation: 111

Try this:-

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

Upvotes: 0

Related Questions