ios 通过 CocoaPods 集成 Fabric/Crashlytics

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29071277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 05:12:58  来源:igfitidea点击:

Integrate Fabric/Crashlytics via CocoaPods

ioscocoapodscrashlyticstwitter-fabric

提问by swalkner

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

我尝试通过 CocoaPods 集成 Fabric/Crashlytics,我的 Podfile 如下所示:

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 Errorthat the run script isn't found:

但是当我尝试构建我的应用程序时,构建失败并且我得到一个Shell Script Invocation Error没有找到运行脚本的消息:

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

Is it possible to install Fabric only using CocoaPods?

是否可以仅使用 CocoaPods 安装 Fabric?

回答by Steven Hepting

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

Fabric 现在支持使用 CocoaPods 进行安装:http://docs.fabric.io/ios/fabric/cocoapods.html

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

如果你只是在寻找Crashlytics你可以使用这两个豆荚:

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 TwitterKityou will need to include:

如果您想使用TwitterKit,则需要包括:

pod 'TwitterKit'

回答by c3r34l

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.

换句话说,只需添加一个额外的 '.' 指定“Pods”目录是构建目录的兄弟目录而不是子目录。天啊。

回答by jaygooby

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

我遇到了同样的问题,使用$PODS_ROOT指向您的 Pods 文件夹的环境变量;如果您的路径中有空格,请务必引用它;所以而不是

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

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

use

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

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

回答by eric long

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.

  1. 删除 podfile 中的 Fabric 和 Crashlytics。

  2. 吊舱安装

  3. 再次将 Fabric 和 Crashlytics 添加到 podfile

  4. 吊舱安装

  5. 像上面的答案一样添加运行脚本。

Hope it help.

希望有帮助。

回答by Adam Smaka

macOS Sierra, Swift 3

macOS 塞拉利昂,Swift 3

change

改变

${PODS_ROOT}/Fabric/run

to

"${PODS_ROOT}/Fabric/run"

回答by UnRewa

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

回答by brandonscript

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

我不得不使用 CocoaPods 0.39 在 Xcode 7 中使用不同的路径:

${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.1for details.

我也刚刚将 Fabric 更新为 3.4.1,并且该路径 ^ 略微更改为Fabric/run. 确保${SRCROOT}仔细检查这些位并将其与 Fabric 应用程序推荐的内容进行比较。有关详细信息,请参阅3.4.1 的变更日志

回答by keyboardsamurai

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/CrashlyticsFrameworkadvises to use ./Pods/CrashlyticsFramework/Crashlytics.framework/runhowever, I found I had to use ./Pods/Fabric/Fabric.framework/runfor my installation. Anyways you will have to dig through the Pods directory to find what you are looking for.

当你使用 Cocoapods 时,构建阶段执行的脚本的路径是不同的。https://github.com/bpoplauschi/CrashlyticsFramework上的 github 页面建议使用./Pods/CrashlyticsFramework/Crashlytics.framework/run但是,我发现我必须使用./Pods/Fabric/Fabric.framework/run我的安装。无论如何,您将不得不深入 Pods 目录以找到您要查找的内容。

回答by orta

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

如果您依赖于旧 Podspecs 的特定内容并且还不能更新到官方库,您可以添加

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 FabricSpecsrepo for more details.

在 Podfile 的顶部,它会在新版本之前查找旧的非官方版本。有关更多详细信息,请参阅FabricSpecs 存储库。

回答by deepax11

For my project, this worked:

对于我的项目,这有效:

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