Integrate Fabric/Crashlytics via CocoaPods
Asked Answered
S

16

54

I try to integrate Fabric/Crashlytics via CocoaPods, my Podfile looks like this:

pod 'Fabric/Core', '1.2'
pod 'Fabric/Crashlytics', '1.2'

But when I try to build my app, the build fails and I get a Shell Script Invocation Error that the run script isn't found:

.../Script-F8D74CB61AB5D7A50013D134.sh: line 2: ./Fabric.framework/run: No such file or directory

Is it possible to install Fabric only using CocoaPods?

Stokeontrent answered 16/3, 2015 at 7:6 Comment(6)
Why don't you use the Fabric App that automatically installs the SDK and generates your App ID etc?Hilar
because I like updating external frameworks via Cocoapods and would love to have everything in one place.Stokeontrent
Any other pros and cons of pod approach vs. using the app installation?Theophylline
I have encountered far too many build errors after updating via the Fabric App. So I have gone back to the good ol' pod. +1 @StokeontrentWhalebone
@JoeBlow why that?Stokeontrent
fabric.io/kits/ios/crashlytics/installSubacute
V
167

Fabric now supports installation with CocoaPods: http://docs.fabric.io/ios/fabric/cocoapods.html

If you are just looking for Crashlytics you can use these two pods:

pod 'Fabric'
pod 'Crashlytics'

Along with adding the following build phase script (note: In case the path to your repo contains spaces, you will need the quotes):

"${PODS_ROOT}"/Fabric/run <API Key> <Build Secret>

Run Script Build Phase

If you are looking to use TwitterKit you will need to include:

pod 'TwitterKit'
Vehicular answered 15/7, 2015 at 20:9 Comment(10)
Folks who get here after the great Crashlytics Cocoapods cataclysm of 2015-07-15 should upvote this answer to push it up the page. THIS should be the accepted answer now.Disfigurement
This does not work if you build crashlytics into a local pod and include the local pod in your final target.Vinia
@Vinia Is there any way currently to use Crashlytics in a pod, rather than in your final target. I'm trying to make this work right now.Pickard
@AnthonyM github.com/CocoaPods/Specs/pull/13315 fixed the issue for the Crashlytics pod. The root appears to be a greater bug in CocoaPods, though.Vinia
@Vinia Thank you. github.com/CocoaPods/CocoaPods/issues/2926 It seems that this isn't a bug in CocoaPods, but a limitation of Xcode. Until Crashlytics is released as a dynamic framework, rather than a static library, you won't be able to have a dependency on Crashlytics in a pod spec.Pickard
Another note, for some reason I couldn't get this to work when installing TwitterKit pod on my own. After uninstalling, Fabric still said I had it "Installed". So I had to comment out all of my TwitterKit code including Imports so it would build, Click the "Installed" button in Fabric, and then it told me to install both the TwitterKit pod AND the TwitterCore pod. I don't understand why it's like this. If you install the TwitterKit pod, shouldn't it auto install the TwitterCore pod? Isn't that the whole point of using Cocoapods?Broderick
@AnthonyM I'm not sure the issue is exactly the same. The headers aren't even visible to the static library linking against the framework. For example, I can't #import <Crashlytics/Crashlytics.h> even in the pod that has the direct dependency on Fabric and Crashlytics.Vinia
I had a persistent build error with the Run Script phase as advised, until I removed the double quotes from around the command.Collum
In case the path to your repo contains spaces, you might want to do "${PODS_ROOT}"/Fabric/Fabric.framework/run (note the quotes)Butterflies
This comment helped me when I wanted to remove Crashlytics and Fabric from my project. Make sure to remove above run script from your Build Phases.Apteral
D
10

Same problem for me was fixed by changing the line from:

./Pods/Fabric/Fabric.framework/run YOUR_API_KEY YOUR_BUILD_SECRET

to:

../Pods/Fabric/Fabric.framework/run YOUR_API_KEY YOUR_BUILD_SECRET

In other words, just prepend an extra '.' to designate that the 'Pods' directory is a sibling rather than a child of the build directory. YMMV.

Dobson answered 13/5, 2015 at 22:40 Comment(0)
I
9

I had the same problem, use the $PODS_ROOT environment variable which points to your Pods folder; be sure to quote it in case you have spaces in your path; so instead of

./Pods/Fabric/Fabric.framework/run YOUR_API_KEY YOUR_BUILD_SECRET

use

"$PODS_ROOT"/Fabric/Fabric.framework/run YOUR_API_KEY YOUR_BUILD_SECRET

Interrelation answered 30/6, 2015 at 10:28 Comment(0)
R
8

Try:

  1. Remove Fabric and Crashlytics in podfile.

  2. pod install

  3. Add Fabric and Crashlytics to podfile again

  4. pod install

  5. Add Run script like above answer.

Hope it help.

Ransom answered 25/11, 2015 at 3:12 Comment(0)
F
7

macOS Sierra, Swift 3

change

${PODS_ROOT}/Fabric/run

to

"${PODS_ROOT}/Fabric/run"
Fantinlatour answered 21/9, 2016 at 10:39 Comment(0)
P
5

I had to use a different path in Xcode 7 using CocoaPods 0.39:

${SRCROOT}/Pods/Fabric/Fabric.framework/run <key> <secret>

podfile:

pod 'Crashlytics'
pod 'Fabric'

I also just updated Fabric to 3.4.1, and that path ^ changed slightly to Fabric/run. Make sure you check the bits after ${SRCROOT} carefully and compare it to what the Fabric app recommends. See the changelog for 3.4.1 for details.

Proximal answered 17/9, 2015 at 0:9 Comment(2)
I'm on Xcode 7.1 beta 1 and CocoaPods 0.39 and I still get the issue. Were you able to test this in a Xcode 7.1 beta?Devastation
I haven't tried again on 7.1, but check the path in build settings nonetheless.Proximal
K
5

in

Fabric (1.6.7)

You should change path from

"${PODS_ROOT}/Fabric/Fabric.framework/run" YOUR_API_KEY YOUR_BUILD_SECRET

to

"${PODS_ROOT}/Fabric/run"  YOUR_API_KEY YOUR_BUILD_SECRET
Koral answered 24/3, 2016 at 8:30 Comment(0)
M
3

The path to the script that is executed during the build phase is different when you use Cocoapods. The github page on https://github.com/bpoplauschi/CrashlyticsFramework advises to use ./Pods/CrashlyticsFramework/Crashlytics.framework/run however, I found I had to use ./Pods/Fabric/Fabric.framework/run for my installation. Anyways you will have to dig through the Pods directory to find what you are looking for.

Mossgrown answered 8/5, 2015 at 12:14 Comment(0)
E
2

If you update to Fabric & Crashlytics from older version:

  1. If you have any data in your info.plist file by the key Fabric, make sure to delete all that info along with the key.
  2. Use simple "${PODS_ROOT}/Fabric/run" script. Don't add any API_KEY and BUILD_SECRET

That worked for me, hope this helps.

Englishry answered 7/6, 2018 at 9:20 Comment(0)
G
1

If you relied on something specific to the older Podspecs and can't update to the official libraries yet, you can add

source 'https://github.com/orta/FabricSpecs.git'
source 'https://github.com/CocoaPods/Specs.git'

To the top of your Podfile, and it will look for the older -unofficial- versions before the new ones. See the FabricSpecs repo for more details.

Glucoside answered 16/7, 2015 at 9:9 Comment(0)
N
1

For my project, this worked:

"${PODS_ROOT}/Fabric/Fabric.framework/run" YOUR_API_KEY YOUR_BUILD_SECRET
Nahshon answered 18/5, 2016 at 20:27 Comment(1)
how to know YOUR_API_KEY and YOUR_BUILD_SECRET ?Archiearchiepiscopacy
H
0

Typically I would recommend not going against the grain and using the Fabric App for installation. Its hands down the simplest integration tool I've ever seen given the complexity they are providing.

That being said, since you're dead set on using Cocoapods, the only way to get things going would be the following

  1. Run the Crashlytics App installer to the point where they give you the build phase script.
  2. Copy the script
  3. Undo the installation
  4. Install via Cocoapods
  5. Add the copied script to your buildphase
Hilar answered 16/3, 2015 at 7:25 Comment(0)
T
0

I have meet this issue before. Here is my solution. to add the execution mode for the run file automatically before your run the script.

In the Build Phase -> Run Script add following line:

chmod +x ./Pods/CrashlyticsFramework/Crashlytics.framework/run

./Pods/CrashlyticsFramework/Crashlytics.framework/run YOUR_API_KEY YOUR_BUILD_SECRET
Tidings answered 10/7, 2015 at 2:22 Comment(0)
P
0

Delete podfile.lock and manifest.lock, then re-run podfile install, then continue from there using the "easy" configure app from Fabric.

There are some very nice screen-shot slide-show demos on Fabric.io's site. I found them with Google - don't see where they are accessible from the site.

FYI, if you're having issues, it's not you :). Basically (as of August 3rd), every step of the Fabric onboard process is potentially broken.

  • If you're lucky, you might have no issues.
  • If you're not, :( you might have issues to resolve at every step, including signing up for the service which can put you in an endless sign-up loop, and so on from there.

Hopefully these will all get fixed soon.

Warning: most of the answers you will find via a search will be outdated, because apparently fabric.io changed a lot on July 15th, but if you scroll down anything you find on stack/o, you might find a newer answer.

Peloria answered 3/8, 2015 at 20:22 Comment(0)
S
0

Make sure to uninstall pod 'Answers', '~> 1.3' from your pods if you are using Fabric in your project before.

Scolecite answered 2/4, 2018 at 0:51 Comment(0)
C
0

As mentioned in the official documentation, just update your pods repo

pod repo update
Conducive answered 17/10, 2018 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.