My Xcode project builds and works fine. It has Swift and Objective-C code.
It has GPUImage installed.
I added a unit test to it and now it will no longer compile:
'GPUImage.h' file not found
Failed to import bridging header
Here are the workarounds I have found and tried:
Setting the Product Module Name to match my project: Didn't work http://codesheriff.blogspot.co.il/2015/05/importing-swift-code-from-objective-c.html
Ensured my build phases matched: Didnt work
Expanding the header search paths: Didnt work https://stackoverflow.com/a/29902874/3324388
This question seems to have the same issue: added unit testing target to xcode - failed to import bridging header won't go away
If you know why XCode can't find my BridgingHeader.h or GPUImage.h then please share. I am trying to get Unit Testing working with Travis CI but can't get passed the compile step.
Xcodebuild
doesn't properly support test targets and application tests. I'd try xctool, which is a nice alternative to xcodebuild
and makes it easier to test iOS and OSX apps. Travis CI comes with it pre-installed.
To install it locally on your machine, you can use homebrew.
update brew
brew install xctool
You can use the following command to build your code. Its structure is identical to xcodebuild
.
xctool test -workspace MyExampleProject.xcworkspace -scheme MyExampleTests -sdk iphonesimulator
To run it on Travis CI, add the following code to your .travis.yml
language: objective-c
script:
- xctool -workspace MyExampleProject.xcworkspace -scheme MyExampleProject -sdk iphonesimulator
- xctool test -workspace MyExampleProject.xcworkspace -scheme MyExampleProjectTests -sdk iphonesimulator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With