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

前端 未结 5 1216
轻奢々
轻奢々 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:49

    If you use CocoaPods as package manager, must set search path etc. Give a simple way,

    Try adding this in your Podfile:

    target 'YourProductTests' do
        inherit! :search_paths
        # Pods for testing
    end
    

    and pod install

    It works for me.

    If the above solution does not work for you, try setting manually:

    1. Click your Test target -> Build Setting-> tab: All & Combined -> Swift Compiler -Code Generation -> Objective-C Bridging Header : add your xxx-bridging-header

    2. Check "Search Path", set up value of Framework Search Path, Header Search Paths, Library Search Path according to your main target. Maybe some search path lose here, manually add again.

提交回复
热议问题