54
votes

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?

16
Why don't you use the Fabric App that automatically installs the SDK and generates your App ID etc?Daniel Galasko
because I like updating external frameworks via Cocoapods and would love to have everything in one place.swalkner
Any other pros and cons of pod approach vs. using the app installation?Brad Thomas
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 @swalknerBenjamin
@JoeBlow why that?swalkner

16 Answers

167
votes

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'
10
votes

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.

9
votes

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

8
votes

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.

7
votes

macOS Sierra, Swift 3

change

${PODS_ROOT}/Fabric/run

to

"${PODS_ROOT}/Fabric/run"
5
votes

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.

5
votes

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
3
votes

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.

1
votes

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.

1
votes

For my project, this worked:

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

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.

0
votes

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
0
votes

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
0
votes

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.

0
votes

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

0
votes

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

pod repo update