问题
I had created an Xcode project without unit testing. I have added cocoa pods when I try to create a new unit testing and try to import @testable import 'ProjectName' it gives an error Failed to load module 'ProjectName'. can u please help me out to solve the problem
@testable import 'ProjectName' Failed to load module
回答1:
Update Podfile like this and check
target 'App' do
pod 'Alamofire'
target 'Demo AppTests' do
inherit! :search_paths
end
target 'Demo AppUITests' do
inherit! :search_paths
end
end
回答2:
If your problem is not solved after trying @Naveen's answer and you have Obj-c bridging-header in your main target, you should create another briding-header with the same values for your tests.
来源:https://stackoverflow.com/questions/56163189/how-to-fix-testable-import-failed-to-load-module-in-xcode-unit-testing