I have an existing Objective-C project and I want to add a new Xcode 7 UI testing target with OHHTTPStubs as a dependency.
I added the new (Swift 2.0) UI testing target in Xcode, then added this to my Podfile
:
target 'FooUITests' do
pod 'OHHTTPStubs', '4.0.1'
end
I ran pod update
, cleaned, and rebuilt. But when I try and import OHHTTPStubs
at the top of the template UI test .swift file Xcode created for me, it complains "No such module 'OHHTTPStubs'".
I'm using Cocoapods version 0.37.2—is importing an Objective-C dependency into a Swift (... UI test) target even meant to work?
UPDATE: As noted in my self-answer below, adding use_frameworks!
to my Podfile gets me clean compilation—I can import OHHTTPStubs
at the top of my test file, reference classes and methods, code completion works—but when I actually go to run the tests I get the following output in the Xcode console:
2015-06-18 10:06:57.134 XCTRunner[51557:609693] The bundle “FooUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2015-06-18 10:06:57.135 XCTRunner[51557:609693] (dlopen_preflight(/Users/foo/Library/Developer/CoreSimulator/Devices/38181A1B-67B1-4D7F-B434-85361533F985/data/Containers/Bundle/Application/83C68748-55A3-4A02-8862-C18ADEF895B5/FooUITests-Runner.app/PlugIns/FooUITests.xctest/FooUITests): Library not loaded: @rpath/OHHTTPStubs.framework/OHHTTPStubs
Referenced from: /Users/foo/Library/Developer/CoreSimulator/Devices/38181A1B-67B1-4D7F-B434-85361533F985/data/Containers/Bundle/Application/83C68748-55A3-4A02-8862-C18ADEF895B5/FooUITests-Runner.app/PlugIns/FooUITests.xctest/FooUITests
Reason: image not found)
There do seem to be Release-iphoneos
and Release-iphonesimulator
builds of the OHHTTPStubs.framework
under my ~/Library/Developer/DerivedData
directory though.
Any hints as to what is going on?