Naar console

Test your Firebase Crashlytics implementation

Force a crash to test your implementation

You don't have to wait for a crash to know that Crashlytics is working. You can use the SDK to force a crash by adding the following code to your app:

#import "ViewController.h"
#import <Crashlytics/Crashlytics.h>

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];


    UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(20, 50, 100, 30);
    [button setTitle:@"Crash" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(crashButtonTapped:)
    [self.view addSubview:button];

- (IBAction)crashButtonTapped:(id)sender {
    [[Crashlytics sharedInstance] crash];

import UIKit
import Crashlytics

class ViewController: UIViewController {
    override func viewDidLoad() {


        let button = UIButton(type: .roundedRect)
        button.frame = CGRect(x: 20, y: 50, width: 100, height: 30)
        button.setTitle("Crash", for: [])
        button.addTarget(self, action: #selector(self.crashButtonTapped(_:)), for: .touchUpInside)

    @IBAction func crashButtonTapped(_ sender: AnyObject) {

Adjust your project's debug settings

Crashlytics can’t capture crashes if your build attaches a debugger at launch. Adjust your build settings to change the project's debug information format:

  1. With your project still selected in the Xcode Navigator, open the Build Settings tab.
  2. Click All at the top of the tab to display all build settings.
  3. Search for "debug information format".
  4. Set the Debug Information Format setting to DWARF with dSYM File.

Test it out

The code snippet above adds a button that crashes your app when pressed. For it to work, run the app without a debugger:

  1. Click play_arrow Build and then run the current scheme in Xcode to build your app on a device or simulator.
  2. Click stop Stop running the scheme or action in Xcode to close the initial instance of your app. This initial instance includes a debugger that interferes with Crashlytics.
  3. Open your app again from the simulator or device.
  4. Touch Crash to crash the app.
  5. Open your app once more to let the Crashlytics API report the crash. Your crash should show up in the Firebase console within 5 minutes.

Enable Crashlytics debug logging

If your forced crash didn't crash, crashed before you wanted it to, or you're experiencing some other issue with Crashlytics, you can enable Crashlytics debug logging to track down the problem.

Crashlytics 3.11.1+

To enable debug logging on your development device, specify the following command line argument in Xcode:

Previous Versions
- (BOOL)application:(UIApplication *)application
          didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        // Initialize Firebase service.
        [FIRApp configure];
        [Fabric.sharedSDK setDebug:YES];
        return YES;
func application(_ application: UIApplication, didFinishLaunchingWithOptions
        // Initialize Firebase service.
        Fabric.sharedSDK().debug = true
        return true

Next steps
