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

非 Y 不嫁゛ 提交于 2019-12-08 21:21:32

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/32150012/xcode-6-4-swift-unit-test-wont-compile-gpuimage-h-not-found-failed-to-impor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!