Failed to emit precompiled header for bridging header
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
Xcode 9 - failed to emit precompiled header
Finally i got the solution of this issue.
In my project the Prefix Header
path is not clearly defined. Earlier the path was
$(SRCROOT)/MyPrefixHeaderFile.pch
MyPrefixHeaderFile.pch
is in another folder inside the project folder, So i update the Prefix Header
path to
$(SRCROOT)/FolderName/MyPrefixHeaderFile.pch
Xcode failed to emit precompiled header?
This error is about a malformed bridging header. The bridging header is a special header file which lists all Objective-C header files with classes that must be accessible from Swift code. All the bridging header definitions are precompiled in a way to be ready to use from Swift. In your case the bridging header is "Alavoc/bridge/Alavoc-Bridging-Header.h", and it includes a header for customClassViewController.h (from Alavoc/externalLib/customClass), which indicates that your fellow developer wants that customClassViewController is accessible in Swift code.
Now the confusing thing about the bridging header is that it is not recursively including everything, i.e. it just looks on the first level of definitions, and if you import something in your import that you want in Swift, you have to add it to the bridging header explicitly, or else you'll probably get a warning (or an error sometimes). Say you have #import "A.h"
in the bridging header, and you have #import "B.h"
inside "A.h", then you likely would have to add "B.h" to the bridging header as well.
Now in your example A = customClassViewController, and B = FMDB, and normally you would need to add FMDB to the bridging header, but the thing is that you most likely don't want exporting FMDB to Swift via your bridging header, because it is not meant for this (it is for your own objc code and not for 3rd party libs).
The solution would be to remove line 13 from your "customClassViewController.h". This would likely fix the bridging header compilation, but probably break the customClassViewController, so you need to include FMDB in "customClassViewController.m" and most likely adapt the "customClassViewController.h" to not have anything related to FMDB (or forward-declare those usages with @class X;
).
If you move #import <FMDB/FMDB.h>
to your implementation (.m) files and still get error: 'FMDB/FMDB.h' file not found
, it is likely about FMDB path not being listed in your header search paths.
To solve the last one just include the right path in your "Header Search Paths" in Xcode build settings. Let's say FMDB is located at /Users/me/Downloads/Alavoc-ios-master/Alavoc/ASDASD/FMDB (and you have /Users/me/Downloads/Alavoc-ios-master/Alavoc/ASDASD/FMDB/FMDB.h inside), Then you need to open Xcode project settings - select your target on the left - select "Build Settings" on the top - find "Header Search Paths" setting and add /Users/me/Downloads/Alavoc-ios-master/Alavoc/ASDASD path
Xcode 10, 11 - failed to emit precompiled header
The solution to my problem was that the 3rd party library of GPUImage was used by external library linking and bridging-header.
I removed the library and installed it via cocoapod.
Related Topics
Creating and Playing a Sound in Swift
How to Determine If an Nsdate Is Today
Rotation Methods Deprecated, Equivalent of 'Didrotatefrominterfaceorientation'
Restoring Animation Where It Left Off When App Resumes from Background
Tweening/Interpolating Between Two Cgpaths/Uibeziers
Uitableviewcell with Autolayout Left Margin Different on iPhone and iPad
Auto Layout in Uicollectionviewcell Not Working
Secure Keys in iOS App Scenario, Is It Safe
How Does Apple Notify iOS Apps of Refunds of In-App Purchases (Iap)
How to Implement Uipageviewcontroller That Utilizes Multiple Viewcontrollers
How to Get Rgb Values from Uicolor
Get Utc Time and Local Time from Nsdate Object
How to Programmatically Enable Guided Access (Kiosk Mode) on an Iphone