How can I fix "Symbol not found: _NSURLSessionTransferSizeUnknown" when running tests using Travis that work locally? - objective-c

The command xctool -workspace Foo.xcworkspace -scheme Foo -sdk macosx -configuration Debug test -test-sdk macosx works locally and all of the tests pass.
Using Travis I get the following error:
Failed to query the list of test cases in the test bundle: dlopen(/Users/travis/Library/Developer/Xcode/DerivedData/Foo-bvxkmfrwzzvtxgaeoosknyzjovjc/Build/Products/Debug/OS X Tests.xctest/Contents/MacOS/OS X Tests, 2): Symbol not found: _NSURLSessionTransferSizeUnknown
Referenced from: /Users/travis/Library/Developer/Xcode/DerivedData/Foo-bvxkmfrwzzvtxgaeoosknyzjovjc/Build/Products/Debug/OS X Tests.xctest/Contents/MacOS/OS X Tests
Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
in /Users/travis/Library/Developer/Xcode/DerivedData/Foo-bvxkmfrwzzvtxgaeoosknyzjovjc/Build/Products/Debug/OS X Tests.xctest/Contents/MacOS/OS X Tests
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
** TEST FAILED: 0 passed, 0 failed, 0 errored, 0 total ** (21121 ms)
The command "xctool -workspace Foo.xcworkspace -scheme Foo -sdk macosx -configuration Debug test -test-sdk macosx" exited with 1.
My .travis.yml file is as follows:
language: objective-c
before_install:
- gem install cocoapods --no-ri --no-rdoc --no-document --quiet
- brew update
- brew uninstall xctool
- brew install xctool
script:
- xctool -workspace Foo.xcworkspace -scheme Foo -sdk macosx -configuration Debug test -test-sdk macosx
Why does this happen and how can I fix this?

Travis does not currently support Mavericks which is the root cause of the problem.
Support for 10.9 is being tracked in this issue on GitHub.

Related

xcodebuild test on Xcode 14: Could not find test host for DoSomethingElseTests: TEST_HOST evaluates

I'm running the following command to build and test my project:
xcodebuild -sdk iphonesimulator -configuration DoSomethingElse -project DoSomethingElse.xcodeproj -scheme DoSomethingElse -destination "platform=iOS Simulator,name=iPhone 8 Plus" test
But I'm getting this error:
Reason: Could not find test host for DoSomethingElseTests: TEST_HOST evaluates
But I run the unit test using XCode IDE works just fine.
Any of you knows what I'm doing wrong?, or if there is a way around this?
I'll really appreciate your help

How do I fix Something went wrong in #nrwl/run-commands - Command failed: detox build -c ios.sim.retail.debug

I am experiencing an issue with opening an app for the first time
detox[12987] ERROR: [cli.js] Command failed: export EXCLUDED_ARCHS=arm64 && ENVFILE=.env.dev.detox xcodebuild -workspace ./apps/retail-mobile/ios/app.xcworkspace -scheme app -configuration Debug -sdk iphonesimulator -derivedDataPath ./apps/retail-mobile/ios/build -quiet
ERROR: Something went wrong in #nrwl/run-commands - Command failed: detox build -c ios.sim.retail.debug
How do I fix this? I'm totally confused as it was working before.

Xcodebuild calling test but never running

I'm trying to run tests with the xcodebuild command line in this way ("Ink" is my project):
xcodebuild test -target "Ink" -sdk iphonesimulator TEST_AFTER_BUILD=YES "VALID_ARCHS=armv6 armv7 i386" -arch i386
but the command prompt give me the result:
unsupported build action 'test' - ** TEST FAILED **
What command is missing?
I guess that the command You try to run is badly ordered (the action You want to execute should always be at the end), try:
xcodebuild -target "Ink" -sdk iphonesimulator TEST_AFTER_BUILD=YES "VALID_ARCHS=armv6 armv7 i386" -arch i386 clean test
I also suppose it may be simplified to:
xcodebuild -target "Ink" -sdk iphonesimulator clean test
Which version of xcodebuild You use? Prior to 5.0 it was impossible to execute test action from command line.

xcodebuild builds test target but cannot run xctest

I run a command in terminal
sudo /usr/bin/xcodebuild -project awesome.xcodeproj -scheme "AwesomeTests"
-configuration Production test -derivedDataPath ~/Documents/buildData
-sdk "OS X 10.9"
last lines of output looks like
error: failed to launch '/Applications/Xcode.app/Contents/Developer/usr/bin/xctest'
-- error: Host::LaunchProcess (launch_info) => pid=0,
path='/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver'
err = Problems with launching via XPC. XPC error : Connection interrupted (0x00000005)
** TEST SUCCEEDED **
Before outputing these lines I'm prompted with: "xcodebuild is trying to take control of a root process. Type your password to allow this"
I'm using Xcode 5.0.2.
As #trojanfoe noted, the sudo was the cause of the error.
It seems like ~/Documents/buildData folder was created with root permissions and couldn't be accessed from xtest.

GHUnit CLI Build: Availability.h errors

I am trying to do a command line build of a GHUnit target which builds fine inside Xcode. I am running the following command to build:
GHUNIT_CLI=1 xcodebuild -target
BasicBrowserUnitTest -configuration
Debug -sdk iphonesimulator4.0 build
It gets along pretty nice, until it finds an error in Availability.h, an SDK header:
/Xcode4
GM/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/include/AvailabilityInternal.h:56:42:
error: operator '<' has no left
operand
Obviously, I haven't made any changes to Apple's stuff, why am I getting this error and how do I fix it?
The problem is that I wasn't specifying the correct SDK version:
GHUNIT_CLI=1 xcodebuild -target
BasicBrowserUnitTest -configuration
Debug -sdk iphonesimulator4.0 build
Needed to be:
GHUNIT_CLI=1 xcodebuild -target
BasicBrowserUnitTest -configuration
Debug -sdk iphonesimulator4.3
build
Or in this case, the latest SDK version.