marco
marco

Reputation: 676

Xcode 10 Crashlytics Installation

I am having difficulty understanding this step on installing firebase Crashlytics in my app:

Xcode 10 only: Add your app's built Info.plist location to the Build Phase's Input Files field: $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

This what I have so far (please see picture), however, I am not getting any of the crash reports on Crashlytics. Am I putting the code in the wrong place? Where should I put it?
enter image description here

Upvotes: 22

Views: 10711

Answers (6)

PatrickDotStar
PatrickDotStar

Reputation: 1794

Replace the round brackets with curly brackets like this

${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}

You can check if the path actually exists if you call echo $(BUILT_PRODUCTS_DIR) in the script phase. Using round brackets gave me following info in the Xcode build console "BUILT_PRODUCTS_DIR: command not found".

Replacing the round brackets with curly brackets will print the actuall path and therefore the script finally worked for me.

Upvotes: 2

Parth Patel
Parth Patel

Reputation: 919

Please follow below steps to implement firebase crashlytics in to project

1) Setup Firebase account and create your project.

https://firebase.google.com/docs/crashlytics/?authuser=1

Must require this file: GoogleService-Info.plist

You can generate this file from Firebase

2) Install Firebase and Crashlytics using Podfile.

Podfile

3) Go to Project -> Build Phase -> Click on " + " sign

Build Phase

Add run script as per below image

Run Script

4) Import Firebase framework in AppDelegate file.

import Firebase

FirebaseApp.configure()
Fabric.sharedSDK().debug = true

// Put this method in your viewController
@IBAction func btnCrashClick(_ sender: Any) {
    Crashlytics.sharedInstance().crash()
}

Upvotes: 3

Iyyappan Ravi
Iyyappan Ravi

Reputation: 3245

Its xcode 10 or above only,

  1. First add the new run script phase, add

    $(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

example screenshot below,

please check your new run script phase example 2. In the Project Navigator, right click on "Info.plist", and "Open as" → "Source Code", add the below code

<key>Fabric</key>
        <dict>
            <key>APIKey</key>
            <string><FABRIC-API-KEY></string>
            <key>Kits</key>
            <array>
                <dict>
                    <key>KitInfo</key>
                    <dict/>
                    <key>KitName</key>
                    <string>Crashlytics</string>
                </dict>
            </array>
        </dict>

Finally Run your xcode 10 or above, its working fine. hope its helpful

Upvotes: 0

Ayush Goel
Ayush Goel

Reputation: 1103

Go into Build settings of the your target. Find "Debug Information Format". Set this from "DWARF" in both debug and release to "DWARF with dSYM File"

Upvotes: 5

yeh
yeh

Reputation: 1506

Use

$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

instead of

$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

Upvotes: 23

Related Questions