Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 9 - failed to emit precompiled header [duplicate]

I have a project in Objective-C as well as in swift by taking MyProjectName-Bridging-Header.h and i also configured the Objective-C Bridging Header. Also i have added 'MyprojectName-Swift.h' in .pch file.

This works fine on xcode 8.2 but when i build my project from xcode 9 i am getting the below error.

failed to emit precompiled header '/Library/Developer/Xcode/DerivedData/MyprojectName-lajanjvhqjnfjksdsndsfkads/Build/Intermediates.noindex/PrecompiledHeaders/MyprojectName-Bridging-Header-swift_44AHJm3Z96qu-clang_2BIMGQVXGEZ09.pch' for bridging header '/Documents/MyProjectLocaiton/FoneApp-Bridging-Header.h'

Please help me out from this. Thanks!

like image 949
Shubham Avatar asked Sep 19 '17 06:09

Shubham


3 Answers

I found out that I accidentally opened the ProjectName.xcodeproj file rather than the ProjectName.xcworkspace file.

Open the xcworkspace file, project will start working again!

like image 182
nikdange_me Avatar answered Oct 14 '22 23:10

nikdange_me


Read this if you using cocoapods in project. I just update deployment target to iOS 10 or 11 in my case after updating pods and xcode make first build success. So problem was inside podfile where I had line

platform :ios, '11.0'

and my deployment target in project was 9.0 after I change my podfile to platform to

platform :ios, '9.0'

project was fixed.

like image 24
Ivan Besarab Avatar answered Oct 14 '22 23:10

Ivan Besarab


Also make sure your import of "ProductModuleName-Swift.h" is in your .m file, and not your .h file.

like image 14
Elijah Avatar answered Oct 14 '22 23:10

Elijah