Fabric.io implementation (AppDelegate)
Asked Answered
M

3

8

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 screenshot

Maidamaidan answered 25/2, 2015 at 10:32 Comment(0)
G
5

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.

https://dev.twitter.com/twitter-kit/ios/configure

Greenleaf answered 25/2, 2015 at 11:13 Comment(0)
U
2

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]];
Uranic answered 25/2, 2015 at 11:36 Comment(1)
this is more clean to do <Fabric/Fabric.h> instead of "Fabric/Fabric.h" for every frameworkCutler
O
1

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
    }
Oxley answered 12/8, 2015 at 14:49 Comment(1)
@Vive Yes, but it is correct for the last version: Fabric.with accepts arraysOxley

© 2022 - 2024 — McMap. All rights reserved.