Ich habe einen vollständigen Befehl zum Bereitstellen des xCode-Projekts auf einem echten Gerät.xcodebuild Befehl in Shell-Skript iOS
d.h
xcodebuild -workspace jamesAppV2.xcworkspace -scheme jamesAppV2 -configuration Debug -destination 'platform=iOS,name=Shujaat’s iPad' clean test
seine adaequat über die Befehlszeile.
Todo:Ich wollte diesen Befehl über ein Shell-Skript ausführen.
hier ist meine vollständige Shell-Skript deploy.sh
so für.
#!/bin/bash
#My First Script
#Info to be configured
current_path=$(pwd)
appName="jamesApp"
jamesApp_workspace="jamesAppV2.xcworkspace"
echo "Searching for $jamesApp_workspace workspace..."
if [[ $(ls $jamesApp_workspace) ]]; then
echo "$jamesApp_workspace found in current directory."
echo "Listing all installed and connected devices..."
instruments -s devices
echo "Copy + Paste from above devices"
echo "specify name of your decice to launch $appName"
read d_device_name
echo "building workspace for $d_device_name..."
build_cmd=(xcodebuild -workspace jamesAppV2.xcworkspace -scheme jamesAppV2 -configuration Debug)
destination="'platform=iOS,name=$d_device_name'"
build_cmd+=(-destination "$destination" clean test)
echo "${build_cmd[@]}"
# Here it prints the valid command given above
"${build_cmd[@]}"
else
echo "$jamesApp_workspace workspace not found"
echo "Make sure your current path contains the $jamesApp_workspace workspace"
echo "Place this file i.e deploy.sh within the directory containing $jamesApp_workspace workspace"
fi;
Problem: I wie
auf Ausführungbuild_cmd=(xcodebuild -workspace jamesAppV2.xcworkspace -scheme jamesAppV2 -configuration Debug)
destination="'platform=iOS,name=$d_device_name'"
build_cmd+=(-destination "$destination" clean test)
echo "${build_cmd[@]}" #Prints valid command
"${build_cmd[@]}"
aber gibt Fehler gemacht haben
xcodebuild: error: option 'Destination' requires at least one parameter of the form 'key=value'
wenn ich den obigen Befehl über die Befehlszeile seine Arbeit perfekt laufen, aber wenn ich Führen Sie dies über Shell-Skript aus es funktioniert nicht.
Ich habe I want to concatenate arguments of xcodebuild as string, which have space in it ,then run this command bezeichnet den xcodebuild Befehl
Ich entfernte die einfachen Anführungszeichen aus meinem Skript. Jetzt bekomme ich diesen Fehler xcodebuild: Fehler: Scheme jamesAppV2 ist derzeit nicht für die Testaktion konfiguriert .. das ist seltsam. Befehl wird erfolgreich über die Befehlszeile ausgeführt –
@QadirHussain Ihre Frage wurde beantwortet. Dies ist kein fortlaufender Support-Anruf. Stellen Sie eine neue Frage. – trojanfoe
@ Ignacio Vazquez-Abrams bitte beantworten Sie diese http://stackoverflow.com/questions/37042815/xcodebuild-command-in-shell-script-ios/37042925?noredirect=1#comment61639456_37042925 –