Failed to emit precompiled header for bridging hea

2019-01-11 17:46发布

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: enter image description here It can't solve it.

How to make it?

10条回答
疯言疯语
2楼-- · 2019-01-11 18:13

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

  1. First click on the logo

Click on the logo

  1. Then Click 'Edit Scheme':

Edit Scheme

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

Find implicit dependencies

Then make a clean and build again.

查看更多
等我变得足够好
3楼-- · 2019-01-11 18:17

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

查看更多
Anthone
4楼-- · 2019-01-11 18:18

My experience with this is that Xcode is unable to find header files for pods/frameworks imported in the project.

My Project experience with this: Updating Xcode9.2 - 9.3 where many cocoapods had to be updated due to implicit definitions now unavailable or being outdated.
I had changed the Podfile to now include 'use_frameworks!'. Following this and after dealing with other compile issues I found the error you are experiencing. I believe adding 'use_frameworks! was preventing some pods with support prior to iOS 8 from compiling correctly. Steps I took to correct this issue:

  1. I tried deleting the Pods/ directory using cocoa pod deintegrate
  2. I then open project with Xcode and cleaned the build folder and the project. (delete content within derived data folder)
  3. I then pod install again but the issue persisted.

  4. Ultimately I removed the use_frameworks line in Podfile and then repeated steps 1-3 and the project was now able to find the missing header files and the issue never presented it self again.

查看更多
神经病院院长
5楼-- · 2019-01-11 18:21

For my case I had a typo in folder name "Supporing FIles" instead of "Supporting Files".

查看更多
Evening l夕情丶
6楼-- · 2019-01-11 18:22

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 <UIKit/UIKit.h>

查看更多
相关推荐>>
7楼-- · 2019-01-11 18:27

I had same scenario, make sure for the file A that you have included in YourProjectName-Bridging-Header.h

  • if it uses some other class(s), then those other classes are also included before that File A
查看更多
登录 后发表回答