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?

brandonscript
  • 68,675
  • 32
  • 163
  • 220
swalkner
  • 16,679
  • 31
  • 123
  • 210

16 Answers16

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'
Steven Hepting
  • 12,394
  • 8
  • 40
  • 50
  • 9
    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. – Mark Edington Jul 15 '15 at 21:02
  • 1
    This does not work if you build crashlytics into a local pod and include the local pod in your final target. – dcow Jul 16 '15 at 01:10
  • @dcow 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. – AnthonyMDev Jul 17 '15 at 18:26
  • 1
    @AnthonyM https://github.com/CocoaPods/Specs/pull/13315 fixed the issue for the Crashlytics pod. The root appears to be a greater bug in CocoaPods, though. – dcow Jul 17 '15 at 18:52
  • @dcow Thank you. https://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. – AnthonyMDev Jul 17 '15 at 20:12
  • 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? – user3344977 Jul 17 '15 at 22:18
  • @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 ` even in the pod that has the direct dependency on Fabric and Crashlytics. – dcow Jul 17 '15 at 23:07
  • I had a persistent build error with the Run Script phase as advised, until I removed the double quotes from around the command. – Jere Käpyaho Aug 10 '15 at 16:46
  • 6
    In case the path to your repo contains spaces, you might want to do `"${PODS_ROOT}"/Fabric/Fabric.framework/run` (note the quotes) – nevyn Sep 22 '15 at 18:10
  • 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. – Jan Erik Schlorf Mar 09 '18 at 12:14
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.

c3r34l
  • 109
  • 4
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

jaygooby
  • 2,436
  • 24
  • 42
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.

eric long
  • 640
  • 5
  • 16
7

macOS Sierra, Swift 3

change

${PODS_ROOT}/Fabric/run

to

"${PODS_ROOT}/Fabric/run"
Adam Smaka
  • 5,977
  • 3
  • 50
  • 55
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.

brandonscript
  • 68,675
  • 32
  • 163
  • 220
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
UnRewa
  • 2,462
  • 2
  • 29
  • 31
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.

keyboardsamurai
  • 703
  • 1
  • 9
  • 20
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.

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.

orta
  • 4,225
  • 1
  • 26
  • 34
1

For my project, this worked:

"${PODS_ROOT}/Fabric/Fabric.framework/run" YOUR_API_KEY YOUR_BUILD_SECRET
Pang
  • 9,564
  • 146
  • 81
  • 122
deepax11
  • 199
  • 3
  • 7
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
Daniel Galasko
  • 23,617
  • 8
  • 77
  • 97
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
Yurets
  • 3,999
  • 17
  • 54
  • 74
StevenChen
  • 43
  • 1
  • 8
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.

Richard Grossman
  • 741
  • 1
  • 5
  • 10
0

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

Maximo Lucosi
  • 378
  • 4
  • 9
0

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

pod repo update
Vitor Reis
  • 487
  • 6
  • 11