I'm trying to implement Fabric into my app. The problem is, that the app isn't working correctly and I have no idea what code to place in my AppDelegate. I can't find any information on the web what should I implement there. Can anyone give me a tip, what functions should I implement in my AppDelegate?
Fabric.io implementation (AppDelegate)
Asked Answered
Assuming you used the build script to setup Fabric, it will have placed the appropriate consumerKey
and consumerSecret
in your project's info.plist.
You can initialize Fabric with this method:
Swift
Fabric.with(Twitter(), Crashlytics()) // Add whichever Kits you are using
ObjectiveC
[Fabric with:@[[Twitter sharedInstance]]] // Add whichever Kits you are using
Double check that your plist contains an entry for Fabric and add this line of code to your application:didFinishingLaunchWithOptions:
method.
Do you want to use Crashlytics with Objective-C?
In your AppDelegate.m:
At the top of the source file,
#import "Fabric/Fabric.h"
#import "Crashlytics/Crashlytics.h"
and in application:didFinishLaunchingWithOptions:
,
[Fabric with:@[CrashlyticsKit]];
this is more clean to do <Fabric/Fabric.h> instead of "Fabric/Fabric.h" for every framework –
Cutler
For swift the missing code is:
import Fabric
import Crashlytics
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
Fabric.with([Crashlytics()])
//... your initialization code
return true
}
@Vive Yes, but it is correct for the last version: Fabric.with accepts arrays –
Oxley
© 2022 - 2024 — McMap. All rights reserved.