Failed to emit precompiled header for bridging header

匿名 (未验证) 提交于 2019-12-03 01:47:02

问题:

I downloaded a project from GitHub, then pod the following files, some of which are written by OBJ-C and I used a bridge header.

pod ‘SnapKit’ pod ‘MJRefresh’ pod ‘Alamofire’ pod ‘Kingfisher’ pod ‘MBProgressHUD’ pod ‘pop’ pod ‘EVReflection’ pod ‘StreamingKit’ pod ‘iCarousel’ pod ‘ReflectionView’ 

When I run the project with Xcode 9.0 beta 2, but unfortunately the error log as follows :

error: failed to emit precompiled header '/var/folders/kd/4gh0_kxx3jx4thjb_sssmmcw0000gn/T/EvoRadio-Bridging-Header-97bd5f.pch' for bridging header '/Users/ringo/Downloads/EvoRadio-master/EvoRadio/Resources/EvoRadio-Bridging-Header.h'

I have googled, but no such issue.The error means it needs a PCH file? This is my .pch header configuration: It can't solve it.

How to make it?

回答1:

I also got exact same issue (Xcode9 beta 6) after I added cocoa pods for Encrypted Core Data.
This is my PodFile:

# Uncomment the next line to define a global platform for your project platform :ios, '9.0' pod 'EncryptedCoreData', :git => 'https://github.com/project-imas/encrypted-core-data.git'  target 'Root' do   # Comment the next line if you're not using Swift and don't want to use dynamic frameworks   use_frameworks!    # Pods for Root    target 'RootTests' do     inherit! :search_paths     # Pods for testing   end    target 'RootUITests' do     inherit! :search_paths     # Pods for testing   end  end 

Solution:
1 I added $(inherited) non-recursive to Search Path -> Header Search Paths
2 Then added ${PODS_ROOT} recursive to Search Path -> User Header Search Paths
Both the above in my projects' target build settings.

Please have a look at these SO answers:
1 Inherit Header Search Paths
2 Inherit User Search Paths



回答2:

Make sure you're opening the proper project workspace, otherwise, the Podfile may not have all the resources it needs to compile.

I saw this same error on a project that had been working fine previously.

I discovered that I had accidentally opened the ProjectName.xcodeproj file rather than the ProjectName.xcworkspace file. Opened the xcworkspace file and presto, project was working again!



回答3:

You can try this solution. I have solved the same problem by this way.

  1. First click on the logo

  1. Then Click 'Edit Scheme':

  1. Now, under the build tab, check 'Find implicit dependencies':

Then make a clean and build again.



回答4:

For me, this problem occurred when I added new build configuration and scheme to the existing project.

The solution was to run pod install on newly created scheme. After that, project was built successfully.



回答5:

In my case I had the same compiler error with additional errors like "Unknown type" in one of my project files, So I just added this to the problematic file, and it solved it instantly.

#import



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!