I have small problem with implementing xcodebuild command test at CI. I have tests related to specific device language, in xcode I can set "Arguments Passed On Launch" to -AppleLanguages (language). Can I pass that argument using xcodebuild?
My script looks like this
xcodebuild -workspace MyApp.xcworkspace -scheme "MyAppTests" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.0' test
Thanks!
xcodebuild is for build your app. You can use this command to run your app with specific language.
xcrun simctl launch <deviceid> <appid> -AppleLanguages "(pt-BR)"
Hera a sample with all steps to buil and run your app:
xcodebuild -sdk iphonesimulator8.4 -arch i386 install DSTROOT=YourAppFolder
xcrun instruments -w "iPhone 6 (8.4 Simulator)"
xcrun simctl install booted YourAppFolder/Applications/YourApp.app
xcrun simctl launch booted com.yourdomain.yourapp -AppleLanguages "(pt-BR)"
Related
I'm using fastlane to release an app. The simplified version of xcodebuild command to build the app is this:
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos13.6
-destination 'generic/platform=iOS' clean archive
This fails giving (adding a sample):
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:807:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/symbolize.cc:55:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/utilities.h:73:
In file included from /Users/sudeepkumar/Zendrive/mobile-apps/ios/copilot/Pods/glog/src/base/mutex.h:141:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:55:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
I see that it's picking the MacOSX.sdk, I would expect it to pick iPhoneOS sdk present in Xcode directory. Is this the reason for failure? Or something else?
xcrun output:
» xcrun --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform
» xcrun --sdk iphoneos --show-sdk-platform-path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform
Xcode is using the SDK in /Library/CommandLineTools. Instead, it should be using those inside Xcode app. Run
xcode-select -r
or
xcode-select -s "/Applications/Xcode.app/Contents/Developer"
Verify by
xcode-select -p
Some of them may need sudo.
xcodebuild -workspace App.xcworkspace -scheme App
-configuration Release -sdk iphoneos
-destination 'generic/platform=iOS' clean archive
In the xcodebuild man page
-sdk [<sdkfullpath> | <sdkname>]
Build an Xcode project or workspace against the specified SDK,
using build tools appropriate for that SDK. The argument may be an
absolute path to an SDK, or the canonical name of an SDK.
Use xcrun --sdk iphoneos --show-sdk-path to check the SDK path.
Check the SDK you have in your Mac. In my Mac, there are iPhoneOS.sdk and iPhoneOS13.7.sdk
iPhoneOS13.7.sdk is a symbolic link and its origin is iPhoneOS.sdk .
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.7.sdk
Besides,
you can also use xcodebuild -showsdks to see all the sdks
Different parameter for different devices
iOS: -sdk iphoneos
Simulator: -sdk iphonesimulator
watchOS: -sdk watchos
macOS: -sdk macosx
I am trying to emulate our flutter app on Mac and I Get this error:
ProcessException: Process timed out:
Command:
/usr/bin/env xcrun xcodebuild -configuration Debug -quiet -workspace Runner.xcworkspace -scheme Runner BUILD_DIR=/Users/samcromer/Desktop/LightBridge-2/build/ios -sdk iphonesimulator -arch x86_64 FLUTTER_SUPPRESS_ANALYTICS=true COMPILER_INDEX_STORE_ENABLE=NO -showBuildSettings
Is there a way to fix this? I am a windows dev so this doesn't make a lot of sense to me.
I am currently want to create a debug simulator build using xcodebuild command rather than xcode IDE.
however, I always see a "debug-iphoneos" folder is generated, which is for the real device. I expected the simulator output folder "Debug-iphonesimulator"
Can anyone take a look at my script and suggest why the script is not working for simulator?
xcodebuild -scheme "TestApp" -configuration "Debug" -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -workspace TestApp.xcworkspace clean archive -archivePath build/TestApp PROVISIONING_PROFILE="$provisioningUUID" CODE_SIGN_IDENTITY="$codeSignIdentity"
now I can run successfully as below:
xcodebuild -arch i386 -sdk iphonesimulator9.3 -workspace "$app.xcworkspace" -scheme "$scheme" -configuration "Debug"
You should run the following instead:
xcodebuild -arch i386 -sdk iphonesimulator9.1 -workspace [name].xcworkspace -scheme [targetName or ProjectName] ONLY_ACTIVE_ARCH=NO VALID_ARCHS="i386 x86_64"
where iphonesimulator9.1 depends on which iPhone Simulator you installed.
I try to compile my app for UITesting and in a second time run the UITest on iOS simulator. But I need to do this in 2 times.
In one time I use :
xcodebuild -workspace './MyApp.xcworkspace' -scheme 'MyScheme' -derivedDataPath '~/Documents/derived_data/' -destination 'platform=iOS Simulator,id=6EE927C0-FC0E-4235-8915-3BFF1F128B76,OS=9.2' build test | xcpretty
Any Idea how to copy and launch MyApp.app, MyAppUITests-Runner.app in the simulator?
Thanks.
Alak
Edit:
Anyway to launch something like :
xcrun simctl launch "UITest"
and get xcactivitylog from this ?
try this:
xcodebuild -workspace App.xcworkspace -scheme "App-Scheme" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.1' test
it will compile the App and run the UI Test in the simulator.
I'm trying to launch an iOS app tests through command line, from a Jenkins Job.
If I launch the command in my user's console, works ok, the command is:
xcodebuild test -scheme demoIC -destination 'platform=iOS Simulator,id=E6954360-11D9-49E0-9008-A8EE6BA1ACFC'
It's supposed Jenkins uses 'jenkins' user for launching jobs, so I have done:
su - jenkins
And the when I launch the same command, I got an error:
2015-02-16 18:21:41.215 xcodebuild[3952:1303] iPhoneSimulator: Could not launch simulator: -10810
You can give a try to this, it worked for me:
xcrun xcodebuild -workspace $Project_Name.xcworkspace -scheme "$Build_Test_Scheme" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 8,OS=13.2.2' -derivedDataPath './output' test