Xcode 10 无法为桥接标头发出预编译标头

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52463200/
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-09-15 10:48:11  来源:igfitidea点击:

Xcode 10 Failed to emit precompiled header for bridging header

iosobjective-cswiftxcodebridging-header

提问by Jaqueline

Hi I'm getting a very annoying error on Xcode 10 that is

嗨,我在 Xcode 10 上遇到一个非常烦人的错误

1 error generated. <unknown>:0: error: failed to emit precompiled header '/Users/me/Library/Developer/Xcode/DerivedData/APP-hlczpckeselwrtaqjcbxdpoiogkj/Build/Intermediates.noindex/PrecompiledHeaders/APP-Bridging-Header-swift_35K3KO8G70VCD-clang_3DGF15CYP79L0.pch' for bridging header '/Users/me/Desktop/Swift/Folder/APP/APP/UNLKV2-Bridging-Header.h'

1 error generated. <unknown>:0: error: failed to emit precompiled header '/Users/me/Library/Developer/Xcode/DerivedData/APP-hlczpckeselwrtaqjcbxdpoiogkj/Build/Intermediates.noindex/PrecompiledHeaders/APP-Bridging-Header-swift_35K3KO8G70VCD-clang_3DGF15CYP79L0.pch' for bridging header '/Users/me/Desktop/Swift/Folder/APP/APP/UNLKV2-Bridging-Header.h'

I'm not sure how to solve this I have tried everything. It was very sudden today before there was no problem but the second I added the Firebase info.plist to the project I got this error. I have tried to delete the file, made sure the name of the header file was entered correctly in the "Objective-C Bridging Header" and I have it entered as
$(PROJECT_DIR)/$(PROJECT_NAME)/$(PROJECT_NAME)-Bridging-Header.h
I have cleaned and built the project multiple times and reinstalled all the pods.

我不知道如何解决这个问题我已经尝试了一切。今天很突然,之前没有问题,但是第二次我将 Firebase info.plist 添加到项目中时,我收到了这个错误。我试图删除该文件,确保在“Objective-C Bridging Header”中正确输入了头文件的名称,
$(PROJECT_DIR)/$(PROJECT_NAME)/$(PROJECT_NAME)-Bridging-Header.h
并在多次清理和构建项目并重新安装所有 pod 时输入了它。

Besides this, I also get an error that

除此之外,我还收到一个错误

JPSVolumeButtonHandler/JPSVolumeButtonHandler.h' file not found

未找到 JPSVolumeButtonHandler/JPSVolumeButtonHandler.h' 文件

I would really appreciate it if someone could help me solve this, I've been looking around all day at every single post and forum and nothing has worked for me. If you need any more information about this issue, please let me know.

如果有人能帮我解决这个问题,我将不胜感激,我整天都在浏览每个帖子和论坛,但没有任何效果对我有用。如果您需要有关此问题的更多信息,请告诉我。

回答by Oleg Poliukhovych

Had same issue that I've tried to fix for hours. Ended up with this solution:

有同样的问题,我已经尝试修复了几个小时。最终得到了这个解决方案:

  1. select scheme, from appeared menu choose Manage Schemes...
  2. from popped up list of schemes find [Your Project Name]scheme, select it and delete by pressing -button in the bottom left corner of list
  3. Press Autocreate Schemes Nowbutton in the top right corner
  1. 选择方案,从出现的菜单中选择 Manage Schemes...
  2. 从弹出的方案列表中找到[Your Project Name]方案,选择它并按-列表左下角的按钮删除
  3. 按下Autocreate Schemes Now右上角的按钮

Don't have enough reputation for posting embedded images, so here are links for screenshots with steps: https://i.stack.imgur.com/NM76w.pnghttps://i.stack.imgur.com/GzWX3.png

在发布嵌入图像方面没有足够的声誉,因此这里是带有步骤的屏幕截图链接:https: //i.stack.imgur.com/NM76w.png https://i.stack.imgur.com/GzWX3.png

回答by Yolobob

I'm currently facing the exact same problem (with other pod headers missing) ; tried to delete all pod folder, clear cache install again, update pods... nothing works.

我目前面临完全相同的问题(缺少其他 pod 标头);尝试删除所有 pod 文件夹,再次清除缓存安装,更新 pod... 没有任何效果。

Also tried to do as told in xconfig file : FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR) "$(SRCROOT)" "$(SRCROOT)/Framework", but still blocked.

还尝试按照 xconfig 文件 : 中的说明进行操作FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR) "$(SRCROOT)" "$(SRCROOT)/Framework",但仍然被阻止。

This bridging-header error happens when using the "legacy build system", since the new build system given w/ Xcode10 brings many more issues for older projects. Dunno if this is relevant but joining here current build phases of my target.

使用“遗留构建系统”时会发生此桥接头错误,因为使用 Xcode10 提供的新构建系统为旧项目带来了更多问题。不知道这是否相关,但在这里加入我的目标的当前构建阶段

Edit : Eventually I found what my problem was, it may be the same for some.

In the workspace settings I changed the build system to the Legacy one. However, I also thought it was a good idea to change the Build Location to Legacy ; That was what caused my issue.

How I fixed :

a) in the Workspace Settings, let build system on 'Legacy build system'

b) click on Advanced, then change build location to Xcode Default

c) then my build would still fail because of the outdated library libstdc++ ; so i changed it with the libc++ library in my 'common.xconfig' file : CLANG_CXX_LIBRARY = libc++.

Everything works fine for me now. Hope this helps others.

编辑:最终我发现我的问题是什么,对某些人来说可能是一样的。

在工作区设置中,我将构建系统更改为 Legacy 系统。但是,我也认为将 Build Location 更改为 Legacy 是个好主意;这就是导致我问题的原因。

我是如何修复的:

a) 在 Workspace Settings 中,让 build system on 'Legacy build system'

b) 单击 Advanced,然后将构建位置更改为Xcode Default

c) 那么我的构建仍然会因为过时的库 libstdc++ 而失败;所以我用'common.xconfig'文件中的libc++库改变了它:CLANG_CXX_LIBRARY = libc++

现在一切对我来说都很好。希望这对其他人有帮助。

回答by user3576382

Could you search for JPSVolumeButtonHandler/JPSVolumeButtonHandler.h in ...

你能在...中搜索 JPSVolumeButtonHandler/JPSVolumeButtonHandler.h

  1. finder and make sure the file exists.
  2. make sure the file is included in your project.
  3. If JPSVolumeButtonHandler is included in the bridging-header.h but JPSVolumeButtonHandler is somehow missing in source, you could get a emit precompiled error.
  1. finder 并确保文件存在。
  2. 确保该文件包含在您的项目中。
  3. 如果 JPSVolumeButtonHandler 包含在 bridging-header.h 中,但源代码中不知何故缺少 JPSVolumeButtonHandler,您可能会收到一个发出预编译错误。