XCTest does not link iOS frameworks
Asked Answered
M

1

9

I'm running iOS simulator unit tests on the command line using xctest. First I build the target:

xcodebuild -project "build/MyApp.xcodeproj" -target "MyApp Unit Tests" -configuration "Debug" -sdk "iphonesimulator" build

And then run xctest on the test bundle:

xcrun xctest "build/build/Debug-iphonesimulator/MyApp Unit Tests.xctest"

This works fine, and can link frameworks that are in /System/Library/Frameworks like Security. But xctest breaks as soon as I add an iOS SDK framework like MobileCoreServices, giving me:

Library not loaded: /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices

The unit tests run fine in Xcode, and the unit test target includes $(PLATFORM_DIR)/Developer/Library/Frameworks in its Frameworks Search Paths.

Anybody know the right way to make xctest find iOS frameworks?

Mariner answered 17/9, 2015 at 15:0 Comment(0)
N
0

The test target needs to be able to look for frameworks in the built product of MyApp. You should add a framework search path to the test target:

$(CONFIGURATION_TEMP_DIR)/MyApp.build/DerivedSources
Nisus answered 20/10, 2015 at 17:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.