Cannot run tests on Xcode 6 Beta 5

2019-03-26 05:00发布

问题:

I have an iOS project that is using the Kiwi testing framework (latest version 2.3.0 which I installed from cocoapods). At first when I ran the tests I received an error that it cannot find XCTest.h. So I followed the advice on this answer: https://stackoverflow.com/a/24651704/1082326 and the problem went away.

However a different problem arise, now when I try to run the tests when the simulator selected is "iPhone 5 (8.0)" then I get the following error:

IDEBundleInjection.c: Error 3587 loading bundle
'/Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/teacup-tests.octest': 
The bundle “teacup-tests.octest” couldn’t be loaded because it is damaged or missing 
necessary resources.
DevToolsBundleInjection environment:
XCInjectDiagnostics: (null)
XCInjectBundleInto: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup- 
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/valet.app/valet
XCInjectBundle: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/teacup-tests.octest
TestBundleLocation: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator/teacup-tests.octest
TMPDIR: /Users/ifeins/Library/Developer/CoreSimulator/Devices/BC59F7AC-9D3E-4FFC-9726-
97911AA597A6/data/Containers/Data/Application/E1D4A3F0-C06B-485D-BF87-9F5EA70D974A/tmp
DYLD_LIBRARY_PATH: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator
DYLD_INSERT_LIBRARIES: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFra
meworks/IDEBundleInjection.framework/IDEBundleInjection
DYLD_FRAMEWORK_PATH: /Users/ifeins/Library/Developer/Xcode/DerivedData/teacup-
aaenoytmfpqpgmaebqotyfrutlxy/Build/Products/Debug-iphonesimulator
DYLD_FALLBACK_LIBRARY_PATH: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulat
or8.0.sdk/usr/lib
DYLD_FALLBACK_FRAMEWORK_PATH: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk/Developer/Library/Frameworks

Do you know what could be the issue?

Thanks in advance, Ido

回答1:

I have solved this problem by setting code signing as "Don't Code Sign" and cleaning the project (Cmd + Option + Shift + K).



回答2:

Have a look at: https://stackoverflow.com/a/22024428/529243 and https://stackoverflow.com/a/22056161/529243

I had the same error and after working throuhg those steps the problem went away.



回答3:

Use the XCTest conversion wizard:

Edit > Refactor > Convert to XCTest


回答4:

I found one solution from github: https://github.com/kiwi-bdd/Kiwi/issues/570 (Thanks to tjarratt @ https://github.com/tjarratt)

Changing the "Wrapper Extension" for your test bundle from octest to xctest.



回答5:

I had this recently and I discovered that I had added a new XCTest to a target devoted to our older OCTest remnant classes. Just sharing in case it helps anyone in the future.