xcode 未找到 Crashlytics 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17754233/
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
Crashlytics file not found
提问by Snowcrash
Recently opened a project that I had compiled and submitted to Apple.
最近打开了一个自己编译提交给苹果的项目。
I haven't touched it for a couple of months but I'm getting this odd compile error at:
我已经几个月没有碰它了,但是我在以下位置收到了这个奇怪的编译错误:
#import <Crashlytics/Crashlytics.h>
The error reads:
错误如下:
'Crashlytics/Crashlytics.h' file not found
Clearly the framework can't be found but I'm puzzled as to why, when the project was working a few months ago, it's suddenly stopped.
显然找不到框架,但我很困惑,为什么几个月前该项目正在运行时,它突然停止了。
Any suggestions why?
任何建议为什么?
Xcode: 4.6.3 Mac OS X: 10.8.4
Xcode:4.6.3 Mac OS X:10.8.4
回答by Lukasz
Just add $(SRCROOT)
to the Framework Search Pathsin Project Build Settings (Search Paths).
只需在项目构建设置(搜索路径)中添加$(SRCROOT)
到框架搜索路径。
Crashlytics installation process drops its Crashlytics.framework
to your project folder (or creates the symlink).
Crashlytics 安装过程会将其放入Crashlytics.framework
您的项目文件夹(或创建符号链接)。
If you moved Crashlytics.framework somewhere deeper in the project folder hierarchy - set 'recursive' to the right or just point directly to its parent folder in Header Search Paths
:
如果您将 Crashlytics.framework 移动到项目文件夹层次结构中更深的某个位置 - 将“递归”设置为右侧或直接指向其父文件夹Header Search Paths
:
$(SRCROOT)/Path/to/the/folder/containing/Crashlytics.framework
$(SRCROOT)/Path/to/the/folder/containing/Crashlytics.framework
回答by Wez Sie Tato
Delete frameworks from you project and disk. Check that you have the newest version of Fabric plugin.
从您的项目和磁盘中删除框架。检查您是否拥有最新版本的 Fabric 插件。
Copy frameworks from plugin folder to desktop with this commands:
使用以下命令将框架从插件文件夹复制到桌面:
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/com.twitter.crashlytics.ios-default.zip ~/Desktop/
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/io.fabric.sdk.ios-default.zip ~/Desktop/
Add frameworks from desktop to your project.
将桌面框架添加到您的项目中。
Info from: https://twittercommunity.com/t/error-upgrading-from-crashlytics-on-ios/36196/2
信息来自:https: //twittercommunity.com/t/error-upgrading-from-crashlytics-on-ios/36196/2
回答by fluidsonic
I'd recommend just using CocoaPods to add the Crashlytics framework. No need to care about paths anymore.
我建议只使用 CocoaPods 添加 Crashlytics 框架。不再需要关心路径。
Podfile:
播客文件:
pod 'Crashlytics', '~> 3.4.1'
Script Build Phase for dSYM Upload:
dSYM 上传的脚本构建阶段:
./Pods/Crashlytics/iOS/Crashlytics.framework/run <your_crashlytics_id>
Import:
进口:
#import <Crashlytics/Crashlytics.h>
回答by NoelHunter
For me, this worked:
对我来说,这有效:
Remove the fabric and crashlytics frameworks from your project, and delete the files from the disk for our project.
从您的项目中删除结构和 crashlytics 框架,并从我们项目的磁盘中删除文件。
Comment the lines in your appdelegate.m
file, if you added them for the following:
注释appdelegate.m
文件中的行,如果您为以下内容添加了它们:
import Fabric/Fabric.h
import Crashlytics/Crashlytics.h
and
和
[Fabric with:@[CrashlyticsKit]];
In the fabric app, choose "New app", and select your Xcode project file
在 fabric 应用程序中,选择“New app”,然后选择您的 Xcode 项目文件
Recopy the build script and build as instructed. The build step is why you needed to comment the lines above-- it won't work if you leave those lines in.
重新复制构建脚本并按照说明进行构建。构建步骤是您需要注释上面几行的原因——如果您保留这些行,它将不起作用。
After the build script runs, it will prompt you to drag the frameworks from the app window into your project navigator. This will copy the latest versions of he frameworks (which include the .h files) into your project
构建脚本运行后,它会提示您将框架从应用程序窗口拖到项目导航器中。这会将最新版本的框架(包括 .h 文件)复制到您的项目中
I have tried manually downloading, and copying from other projects, but this is the only way I could recover after losing the frameworks files for an app.
我曾尝试手动下载并从其他项目复制,但这是丢失应用程序框架文件后我可以恢复的唯一方法。
回答by Luda
In my case, the Framework was in the project folder, but not in the Project Navigator. I dragged it to the project and everything worked fine.
就我而言,框架位于项目文件夹中,但不在项目导航器中。我将它拖到项目中,一切正常。
回答by rizzes
I've had this issue working with distributed teams (through github) after checking in thenchecking out Crashlytics
. The Crashlytics.framework
will only have one folder inside it -- "Versions". You need to save a version of the contents inside Crashlytics.framework
to another location, then copy-paste them into Crashlytics.framework
later.
在签入然后签出Crashlytics
. 将Crashlytics.framework
只会在其内部都有一个文件夹- “版本”。您需要将内容的一个版本保存Crashlytics.framework
到另一个位置,然后将它们复制粘贴到Crashlytics.framework
稍后。
回答by Dmitry
Remove Crashlytics.framework from the project and disk. Copy and add it again. It helped me.
从项目和磁盘中删除 Crashlytics.framework 。复制并再次添加。它帮助了我。
回答by djibouti33
In my case, I was migrating from an old Crashlytics install through the Mac app to Cocoapods. A lot of the answers to this question recommend completely removing everything and starting over. I started doing this and noticed a discrepancy between code found in Fabric's documentationand the code shown in the Fabric app during the step where it tells you what to copy into your Run Script Build Phase.
就我而言,我通过 Mac 应用程序从旧的 Crashlytics 安装迁移到 Cocoapods。这个问题的很多答案都建议完全删除所有内容并重新开始。我开始这样做并注意到Fabric 文档中的代码与 Fabric 应用程序中显示的代码之间存在差异,该代码告诉您将哪些内容复制到运行脚本构建阶段。
Fabric's documentation has double quotes surrounding the entire string: "${PODS_ROOT}/Fabric/Fabric.framework/run <Your_API_Key> <Your_Build_Secret>"
Fabric 的文档在整个字符串周围有双引号: "${PODS_ROOT}/Fabric/Fabric.framework/run <Your_API_Key> <Your_Build_Secret>"
The Fabric App only had double quotes around the path to the run
executable: "${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
Fabric 应用程序在run
可执行文件的路径周围只有双引号:"${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
So before you delete everything and start over, try updating your Run Script Build Phase to this:
因此,在删除所有内容并重新开始之前,请尝试将运行脚本构建阶段更新为:
"${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 instAustralia
I had previously upgraded to Fabric and had no issues. A couple of days later, I reopened the same project and had the missing crashlytics.h file problem.
我之前已经升级到 Fabric,没有任何问题。几天后,我重新打开了同一个项目,却遇到了 crashlytics.h 文件丢失的问题。
I couldn't simply reinstall from the plugin due to a non compiling project (I had so many CLS_LOG messages and references to the missing crashlytics.h file in my project, it would have taken a long time to remove them just to allow the build to work - refactor wouldn't work on CLS_LOG).
由于一个非编译项目,我不能简单地从插件重新安装(我有很多 CLS_LOG 消息和对我项目中丢失的 crashlytics.h 文件的引用,删除它们需要很长时间才能允许构建工作 - 重构不适用于 CLS_LOG)。
So instead, I deleted the crashlytics.framework from my project and did the following to reinstate it from the plug in directly:
因此,我从我的项目中删除了 crashlytics.framework 并执行以下操作以直接从插件中恢复它:
Download the Fabric plugin again and double click the zip file to unpack the Fabric application.
Right click the Fabric icon and "Show Package Contents"
Copy the Crashlytics.framework folder to your Desktop and then re-add it to your project via File -> Add Files to ....
再次下载 Fabric 插件并双击 zip 文件解压 Fabric 应用程序。
右键单击 Fabric 图标并“显示包内容”
将 Crashlytics.framework 文件夹复制到您的桌面,然后通过 File -> Add Files to ... 将其重新添加到您的项目中。
If step 3 doesn't work for you, you can also add crashlytics.framework to your project folder on your computer directly, and then also add it into your project list via Xcode same as in step 3 but uncheck "Copy Items if Needed" as you already put the files there yourself.
如果第 3 步对您不起作用,您也可以直接将 crashlytics.framework 添加到您计算机上的项目文件夹中,然后通过 Xcode 将其添加到您的项目列表中,与第 3 步相同,但取消选中“Copy Items if Needed”因为你自己已经把文件放在那里了。
My project then compiled and worked fine again.
然后我的项目编译并再次正常工作。
In terms of a guess as to why the file went missing? Part of the upgrade process got me to delete the old frameworks and then run the scripts etc. from the plugin. I think what happened is later when I emptied my trash, that some references were lost. I also had the problem where I'd put Crashlytics into my .gitignore file so it disappeared out of ALL my projects every committed which wasn't great.
关于为什么文件丢失的猜测?升级过程的一部分让我删除旧框架,然后从插件运行脚本等。我想后来发生的事情是当我清空垃圾箱时,一些参考资料丢失了。我也遇到了问题,我将 Crashlytics 放入我的 .gitignore 文件中,因此它从我所有提交的项目中消失了,这不是很好。
Hope this helps someone!
希望这可以帮助某人!
回答by Yunus Nedim Mehel
I have tried to play with the frameworks search path and relocating & reconnecting the framework file; checked the build settings (Link binary with libraries section) but the error persisted.
我尝试使用框架搜索路径并重新定位和重新连接框架文件;检查了构建设置(Link binary with libraries 部分),但错误仍然存在。
Finally, I have reinstalled the framework, which only takes 2-3 minutes. The problem might be caused by that you have relocated the Crashlytics.framework to another subfolder from the root directory, but I am not sure about the exact reason.
最后,我重新安装了框架,只需要2-3分钟。问题可能是因为您将 Crashlytics.framework 从根目录重新定位到另一个子文件夹,但我不确定确切原因。
- Delete everything regarding to the Crashlytics
- Start crashlytics app, login and select your project
- Add run script
- Drag & drop the .framework file (I have kept it in the root folder)
- Add the
import
andstartWithAPIKey
statements back
- 删除与 Crashlytics 相关的所有内容
- 启动 crashlytics 应用程序,登录并选择您的项目
- 添加运行脚本
- 拖放 .framework 文件(我将它保存在根文件夹中)
- 添加
import
andstartWithAPIKey
语句