Xcode 10 Crashlytics Installation
Asked Answered
R

6

22

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

Rebellion answered 28/9, 2018 at 12:23 Comment(3)
Mike from Fabric here. Please make sure you're using the most recent SDK release - 1.7.11 of Fabric and 3.10.8 that should improve this behavior.Takeshi
@droidBomb, regarding your edit, it's nice to capitalize, but it would be better to correct the spelling.Marmalade
does anyone know why there are parenthesis being used instead of curly braces?Biodegradable
S
23

Use

$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)

instead of

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

Spallation answered 24/10, 2018 at 0:15 Comment(3)
do you know if there is anyway to navigate to this directory and to know what each of these variables are on my computer, for me to validate the file exists there ? (I'm asking because firebase is still not finding my Crashlytics as installed)Biodegradable
I cant remember where I saw it today, but someone used echo to find infoplist_pathShoe
why is it prefiled with $(SRCROOT) in xcode and even in the firebase docs if we don't need $(SRCROOT) ?Grower
D
5

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"

Disadvantaged answered 10/12, 2018 at 4:51 Comment(1)
This is the missing step. Thank you!Regulus
C
3

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()
}
Copepod answered 2/4, 2019 at 9:4 Comment(2)
why is it prefiled with $(SRCROOT) in xcode and even in the firebase docs if we don't need $(SRCROOT) ?Grower
@Grower When I read the document of Crashlytics they mention to define prefilled with $(SRCROOT).Copepod
D
2

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.

Deangelo answered 13/4, 2019 at 7:59 Comment(1)
why is it prefiled with $(SRCROOT) in xcode and even in the firebase docs if we don't need $(SRCROOT) ?Grower
S
0

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

Syncytium answered 2/4, 2019 at 6:34 Comment(1)
why is it prefiled with $(SRCROOT) in xcode and even in the firebase docs if we don't need $(SRCROOT) ?Grower

© 2022 - 2024 — McMap. All rights reserved.