Swift “Bridging-Header.h” file not allowing me to instantiate objective-c classes in .swift files

后端 未结 5 1506
执笔经年
执笔经年 2020-12-05 03:10

When X-code tries to create a bridging header automatically, it crashes every single time, so I followed the instructions on how to manually create a bridging header. (Creat

5条回答
  •  無奈伤痛
    2020-12-05 03:33

    You need to add it to your target's build settings:

    1. In Xcode, if you go into the build settings for your target, and scroll all the way down you'll find a "Swift Compiler - Code Generation" section.

    2. Set "Objective-C Bridging Header" to <#PROJECT_NAME>-Bridging-Header.h

    3. I'm not sure of the correct value for "Install Objective-C Compatibility Header", but it's a yes/no, so you can toggle that if it doesn't work at first.

提交回复
热议问题