“Objective-C Bridging Header” entry in Build Settings does not appear in Xcode 8.3

天涯浪子 提交于 2019-12-22 06:55:55

问题


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.h header 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.h Bridging Header file like YourProjectName/YourProject-Bridging-Header.h.

  • Now you can open up your YourProject-Bridging-Header.h and put Objective-C/Swift classes using the #import statement 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

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