Run installed application on iPad (device) from Mac Terminal - macos

I build the application for iPad (from a Terminal) using:
xcodebuild ARCHS=armv7 ONLY_ACTIVE_ARCH=NO VALID_ARCHS=armv7 -scheme MyApp -sdk iphoneos build
Then I deploy it to my iPad using fruitstrap:
./fruitstrap -b Mobile/DerivedData/MyApp/Build/Products/Debug-iphoneos/MyApp.app/
At the next step I have a problem: I need to run the installed application from a Terminal to be able to run the nightly-iterations on Hudson CI.
Any ideas on how to do it?

Related

build and deploy iOS app to local device using CLI

In switching from Cordova to Capacitor we seem to have lost the ability to deploy our app to physical devices using the command line. This is helpful so that our automated build process can push it out to a set of devices we have connected to the server. All the docs for deploying with Capacitor say to open Xcode and select a device for deployment. I'm trying with instruments to get the device ID and then xcodebuild to install it
instruments -s devices | grep -v Simulator | grep -e iPhone -e iPad
xcodebuild install -workspace ios/App/App.xcworkspace -scheme App -destination 'platform=iOS,id=76a....781'
And even though this ends with ** install succeeded ** the app has not been installed on the device
You can consider bumping your Capacitor version to v3.0.0 rc3.. The team is building upon a new command to run the app on device without opening the native ide.
npx cap run ios
Source Discussion Capacitor v3
Alternative - Use Ionic Appflow for deployments.
For Appflow builds on the cloud.. You can do two things there..
Live Deploy - if you have just made any changes to the code, the js, HTML, css side, then use LiveDeploy, this will be much faster for deploying to all the app users.
Native Builds - incase you have added any new plugin or made native configuration changes, then make a native build that can deploy it to test flight and then your tester's can download the updated version from there..
You can also set auto triggers for these workflows as well when you commit your code to the repository.
If waiting for Capacitor 3 is not an option these three lines work
xcodebuild -workspace ios/App/App.xcworkspace/ -scheme App -archivePath ./ios/App.xcarchive archive
xcodebuild -exportArchive -archivePath ./ios/App.xcarchive -exportOptionsPlist ./ios/App/export-development.plist -exportPath ./iOS
ios-deploy --debug --bundle ios/App.ipa

Xcode build succeeds however it does not downloads app on the simulator

Xcode build succeeds however it does not download app on the simulator through terminal.
I am using the below command in mac terminal to build my code, however, the build succeeds but the app does not get downloaded to my ios simulator as it does using the xcode application
xcrun xcodebuild -workspace MyApp.xcworkspace -scheme "Test App" -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.2'
How can i successfully pull my code from Github and then successfully deploy on ios simulator with few lines?
After you build your content, run xcrun simctl install <UDID> <PATH> to install the app in the sim. Be sure you have booted it first as well ( which you can also use simctl for).

Jenkins&Xcode : Build crashes in ipad frequently

I'm currently generating an ios app with distribution profile. When I generate an ipa file from Xcode it works fine without any crashes when installed on an ipad but it crashes in most fields when generated from jenkins as a part CI process. Till now its working fine but the issue started while adding developed frameworks to the project. In jenkins I'm using below command line script for xcodebuild.
. xcodebuild -workspace ~/.jenkins/jobs/workspace/repo/Source/App/App.xcodeproj/project.xcworkspace -scheme App -configuration "release" -sdk iphoneos VALID_ARCHS="armv64 armv7 armv7s i386" archive PROVISIONING_PROFILE="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx" CODE_SIGN_IDENTITY="iPhone Distribution: company Limited" -archivePath ~/Desktop/../App.xcarchive
Unable to find out the exact issue for the crash.
I suggest you to check the environment variable of your jenkins node.. if they are overriding your build variables.
Before this can you provide more details.

Can't run xcodebuild as root

I'm running Xcode 6.4 and trying to build my project using the command line. This works fine without using sudo:
xcodebuild -workspace "project.xcworkspace" -scheme "project"
results in Build Succeeded. However:
sudo xcodebuild -workspace "project.xcworkspace" -scheme "project"
causes the operation to get stuck. I do have Xcode 7.0 Beta installed, is there anyway this could be the issue?
The issue was my schemes were not shared, which caused xcodebuild to get stuck waiting for input
https://github.com/travis-ci/travis-ci/issues/2949

parameter for xcodebuild for using latest sdk.

I using ant exec task to execute xcodebuild to build some iOS projects hudson. I would like to be able to crate script that way that allows not to specify sdk version, because after updating sdk on hudson slave or my iOS projects all my projects failing....
There is is nice option in xcode since sdk 4.2 in target setup Base SDK - Latest iOS
and I don't have to provide -sdk param in xcodebuild command, but then (i think) it's taken from xcode project and it's bad because then some one can change target from simulator to device accidentally during commit.
I need something that is constant. I will prefer not to use env variable because I would like to be able to run this ant task also on dev machines and would like not have to renember about setting it on all machines.
Unfortunately xcodebuild -showsdks gives only:
Mac OS X SDKs:
Mac OS X 10.4 -sdk macosx10.4
Mac OS X 10.5 -sdk macosx10.5
Mac OS X 10.6 -sdk macosx10.6
iOS SDKs:
iOS 4.2 -sdk iphoneos4.2
iOS Simulator SDKs:
Simulator - iOS 3.2 -sdk iphonesimulator3.2
Simulator - iOS 4.0 -sdk iphonesimulator4.0
Simulator - iOS 4.1 -sdk iphonesimulator4.1
Simulator - iOS 4.2 -sdk iphonesimulator4.2
I need something like -sdk iphoneosLatest. My only idea is to pare output of xcodebuild -showsdks with some script, but I don't like this idea.
You can use xcodebuild with the latest SDK using :
xcodebuild -sdk iphoneos, for Device
xcodebuild -sdk iphonesimulator, for Simulator.
We use these options for our automated builds and it's been working since XCode 3.2.5
I believe you can use xcodebuild -sdk iphoneos (no version number) to accomplish this.
I tried #jenningj 's solution and it worked for me. Maciek Sawicki, if this works for you, you should mark it as the right solution.
Also, xcodebuild -showsdk should be xcodebuild -showsdks.
You can try: xcodebuild -showsdks | grep -Eo "iphoneos([0-9]{1,}\.)+[0-9]{1,}"

Resources