Xcode 5 throws "Library not loaded" error when adding a test target

Arie Litovsky picture Arie Litovsky · Sep 24, 2013 · Viewed 7.7k times · Source

I've tried adding a test target on Xcode 5 using the Add Target -> Add Cocoa Touch Unit Testing Bundle. However, when I run the test, I get the following error:

2013-09-24 10:43:14.446 Stack Exchange[48895:c07] Error loading /Users/arielitovsky/Library/Developer/Xcode/DerivedData/MyApp-fjegcztcnwxqdfdimhonqzzqpdwr/Build/Products/Debug-iphonesimulator/Stack Exchange Tests.xctest/Stack Exchange Tests: dlopen(/Users/arielitovsky/Library/Developer/Xcode/DerivedData/MyApp-fjegcztcnwxqdfdimhonqzzqpdwr/Build/Products/Debug-iphonesimulator/Stack Exchange Tests.xctest/Stack Exchange Tests, 262): Library not loaded: /Developer/Library/Frameworks/XCTest.framework/XCTest Referenced from: /Users/arielitovsky/Library/Developer/Xcode/DerivedData/MyApp-fjegcztcnwxqdfdimhonqzzqpdwr/Build/Products/Debug-iphonesimulator/Stack Exchange Tests.xctest/Stack Exchange Tests Reason: image not found IDEBundleInjection.c: Error loading bundle '/Users/arielitovsky/Library/Developer/Xcode/DerivedData/MyApp-fjegcztcnwxqdfdimhonqzzqpdwr/Build/Products/Debug-iphonesimulator/Stack Exchange Tests.xctest' Program ended with exit code: 0

Why isn't this working?

Answer

Arie Litovsky picture Arie Litovsky · Sep 24, 2013

You must run your test on the iOS 7 simulator. It will not work on iOS 6.x.