Added unit testing target to Xcode - failed to import bridging header won't go away

前端 未结 5 1217
轻奢々
轻奢々 2020-12-13 23:47

I added a new Test target to my Xcode project. My project has Swift code and Objective-C code, and has a bridging header. Upon either adding the bridging header to UnitTesti

5条回答
  •  时光取名叫无心
    2020-12-14 00:46

    At this point, I've never had to import MyTarget to get unit tests to work in Swift.

    Common Solutions

    • I assume you tried it, but it wasn't clear if you added your bridging header to your app target and test target at the same time?
    • Another option, that may not be ideal, is to add a bridging header in your test target so that you actually have 2 bridging headers. They should look the same and would be a good test.
    • If using $(SRCROOT) to reference your bridging header path, ensure it is being evaluated to correct path.
    • If all else fails, you should do file diff of your .xcodeproj with the one of your working project and match any relevant values that might be different.

    The bridging header system isn't perfect, but here are a few issues I've run into.

提交回复
热议问题