xcodebuild [MT] iPhoneSimulator: Could not launch simulator: -600 - ios

I can able to run the code local machine. But running on Jenkins slave is failing with following error:
xcodebuild[3082:4342631] [MT] iPhoneSimulator: Could not launch simulator: -600
xcodebuild: error: Failed to build workspace Myproject with scheme Myproject.
Reason: The operation couldn’t be completed. (OSStatus error -600.)
Build step 'Execute shell' marked build as failure.
-----------------script-------------------
xcodebuild \
-workspace Myproject.xcworkspace \
-scheme Myproject \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPad Air 2,OS=9.2' \
test

I am resolved it bu using "Force Quit" for simulator and building project again.

Related

Got an Archive failed when trying "xcodebuild archive" in terminal

I have created a framework with few cocoapod dependencies
.The archive for the framework is failing when i do 'xcodebuild archive' after adding the pod files (Did pod install).
In the normal build, it is working fine. There is no error and the build is successful but when I do 'xcodebuild archive' on my terminal got this below issue.
error: no such module 'Lottie'
import Lottie
^
** ARCHIVE FAILED **
The following build commands failed:
CompileSwift normal arm64 /Users/surya/Documents/Projects/Sampe\ lottie\ test/TestFramework/TestFramework/ViewController.swift
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)
Below is my xcode build archive command
xcodebuild archive \
-scheme TestFramework \
-destination "generic/platform=iOS" \
-archivePath ../Output/TestFramework.framework-iphoneos.xcarchive \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
Found the answer - we need to add - workspace ProjectName.xcworkspace, if our framework uses pods. Check the below command
xcodebuild archive -workspace projectName.xcworkspace \
-scheme projectName \
-sdk iphonesimulator \
-archivePath "./archives/ios_Simulators.xcarchive" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SKIP_INSTALL=NO

"xcodebuild test" keeps breaking my info.plist file

I am trying to test my Unity application on a simulator from command line but when I try to do it, the info.plist file is broken by xcodebuild test.
Here is how I try to do it :
#!/usr/bin/env bash
set -e
xcodebuild \
-project "Tests.ios/Unity-iPhone.xcodeproj" \
-scheme "Unity-iPhone" \
-sdk iphonesimulator \
-derivedDataPath Tests \
-destination "platform=iOS Simulator,name=iPhone 11,OS=13.4" \
test
ENABLE_BITCODE=NO
The error I get is this one :
Testing failed:
Unity-iPhone Tests:
tests.app encountered an error (Failed to install or launch the test runner. (Underlying error: Failed to install the requested application. The bundle identifier of the application could not be determined.))
When I look in the info.plist after the xcodebuild test, there is only two lines :
LastAccessedDate
WorkspacePath
The info.plist was correct before the xcodebuild.
When I try to do it directly from xcode (Product => Test, with the simulator), it succeeds perfectly.
However, when I try to do it directly from xcode after trying to do it with xcodebuild, it fails with the same error than xcodebuild.
Does someone knows how to get rid of this error ?

xcodebuild: error: Failed to build workspace on CI

I got the error on CI:
Error: Command failed: cd ./ios && RCT_NO_LAUNCH_PACKAGER=true xcodebuild build build-for-testing
-scheme "MyReactModule-Unit-MyReactModuleTests"
-workspace MyReactModule.xcworkspace
-sdk iphonesimulator
-configuration Debug
-derivedDataPath ./DerivedData/MyReactModule
-quiet
-UseModernBuildSystem=NO ONLY_ACTIVE_ARCH=YES
Additional logs:
xcodebuild: error: Failed to build workspace MyReactModule with scheme MyReactModule-Unit-MyReactModuleTests.
Reason: The scheme 'MyReactModule-Unit-MyReactModuleTests (MyReactModule Workspace)' is not configured for Running.
How to fix it?

xcodebuild: error: Failed to build workspace. Reason: A build only device cannot be used to run this target

I'm trying to build and test on device (iPhone) using command line:
xcodebuild \
-workspace MyApp.xcworkspace \
-scheme MyApp \
-destination 'generic/platform=iOS,id=iPhoneUUID' \
clean test
But I'm getting this error:
xcodebuild: error: Failed to build workspace MyApp with scheme MyApp.
Reason: A build only device cannot be used to run this target.
Any of you knows why I'm getting this error?
I'll really appreciate any help.
Cut off the generic part in your -destination value. Else Xcode won't try to build for your device, but for the generic build only device:
xcodebuild \
-workspace MyApp.xcworkspace \
-scheme MyApp \
-destination 'platform=iOS,id=iPhoneUUID' \
clean test

Travis CI: BUILD FAILED with Rollout.io lib iOS

I'm running command in Travis CI:
set -o pipefail && xcodebuild -verbose -workspace APP_NAME.xcworkspace -scheme app_name -sdk iphoneos -configuration Release OBJROOT=$PWD/build SYMROOT=$PWD/build clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty
After compiling all files Travis writes:
▸ Running script 'Rollout.io post-build'
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Rollout.io\ post-build build/APP_NAME.build/Release-iphoneos/APP_NAME.build/Script-FBFA10E57CD7495E8662D829.sh
(1 failure)
Can someone help me with this?

Resources