问题
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