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?
Asked
Active
Viewed 2,954 times
3 Answers
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.
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]];

Hiron
- 1,457
- 1
- 13
- 12
-
1this is more clean to do
instead of "Fabric/Fabric.h" for every framework – odemolliens Feb 18 '17 at 15:19
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
}

HotJard
- 4,598
- 2
- 36
- 36
-
@Vive Yes, but it is correct for the last version: Fabric.with accepts arrays – HotJard Aug 13 '15 at 12:05