I have set up an XCode 5 iOS 7 project for unit tests.
Of course, setting up the unit tests are taking me so long that I'm trying to keep the faith that it's worth it. Struggling for hours over this error:
ld: building for iOS Simulator, but linking against dylib built for MacOSX file
'/Applications/Xcode5-DP5.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest'
for architecture i386
Any ideas on how to solve?
Have the same problem after converting tests from SenTestCase to XCTestCase. Reverting framework dirs fixed issue:
I was facing problem while adding sentestingkit framework in xcode 5 . These settings worked for resolving linker problem.
I had the same problem when tried to build XCTTest-based unit tests with pre-7.0 SDK. When I chose 7.0 as my Base SDK then that kind of link error disappeared.
None of the above answers worked for me. I did find an answer here in a comment left by Tim Macfarlane.
So, that means:
Make sure that the Search Framework Path (
FRAMEWORK_SEARCH_PATHS
) for theYourProjectTests
target includes the path$(SDKROOT)/Developer/Library/Frameworks
, and that this one is listed before$(inherited)
.In my case, both paths were present, but
$(inherited)
was the first one.Credit goes to https://stackoverflow.com/users/181947/brian-clear on Apple Mach-O linker (id) warning : building for MacOSX, but linking against dylib built for iOS
I had this problem upon adding another file for tests. If you do this with (CMD + N) be sure to only target the Test Bundle (ie. 'AppNameTests').
I guess only these .xctest bundles have access to the XCTest Framework.