问题
I need to add some Objective-C files of a library to my project, and I created the MyProject-Bridging-Header.h file myself. But now I'm not able to set its path because in the project's Build Settings I don't find the Objective-C Bridging Header entry.
Is somebody else experiencing the same? How could I solve this?
回答1:
In Build Setting choose "all" instead of "basic"
回答2:
Usually when you had an Objective-C/Swift project and have added new Swift/Objective-C class file Xcode asks whether you want to create Bridging Header or not.
If the option to create Bridging Header automatically f.e. has been denied there`s still an option to create it manually.
Since you have already created
YourProject-Bridging-Header.hheader file all you need to set the path to it in your project Build Settings.To set the path to your Bridging Header file you need to navigate to your project Build Setting where look for Swift Compiler – General section like the Hoa mentioned above.
It is located between "Swift Compiler - Custom Flags" and "Swift Compiler - Search Paths" ones at the same page with all "Swift Compiler" sections.There you can see Objective-C Bridging Header which you can click and set the path to your
YourProject-Bridging-Header.hBridging Header file likeYourProjectName/YourProject-Bridging-Header.h.Now you can open up your
YourProject-Bridging-Header.hand put Objective-C/Swift classes using the#importstatement into it.
Thanks to http://www.learnswiftonline.com/getting-started/adding-swift-bridging-header/
And Objective-C Bridging Header not getting created with Xcode 8
来源:https://stackoverflow.com/questions/43720685/objective-c-bridging-header-entry-in-build-settings-does-not-appear-in-xcode-8