Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6.4 Swift Unit Test Won't Compile: "GPUImage.h not found" "failed to import bridging header"

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:

  1. 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

  2. Ensured my build phases matched: Didnt work

  3. 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.

like image 750
Aggressor Avatar asked Aug 21 '15 22:08

Aggressor


1 Answers

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
like image 56
Habíb Khalid Avatar answered Nov 05 '22 13:11

Habíb Khalid