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
Integrate Fabric/Crashlytics via CocoaPods
提问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 Error
that 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 Crashlytics
you 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>
If you are looking to use TwitterKit
you 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_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_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:
尝试:
Remove Fabric and Crashlytics in podfile.
pod install
Add Fabric and Crashlytics to podfile again
pod install
Add Run script like above answer.
删除 podfile 中的 Fabric 和 Crashlytics。
吊舱安装
再次将 Fabric 和 Crashlytics 添加到 podfile
吊舱安装
像上面的答案一样添加运行脚本。
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/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.
当你使用 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