【发布时间】:2015-07-21 23:33:36
【问题描述】:
我正在编写一个 shell 脚本,该脚本将我们的 xcodeproj 直接构建并安装到第一个找到并连接的 iDevice。这是脚本
#!/bin/bash
cd ../../cordova/platforms/ios
deviceName=$(ideviceinfo | grep -i DeviceName)
deviceName=${deviceName//DeviceName: /} #This is the device name you set in Settings->General->Info->Name on your iDevice
deviceUdid=$(system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}')
if [ -n "deviceUdid" ]; then
echo 'Found device "'${deviceName}'" with UUID "'${deviceUdid}'", process...'
xcodeProject=$(ls | grep -i *.xcodeproj)
if [ -n "$xcodeProject" ]; then
echo "Is xCode project dir, start building..."
################### Not working command ###################
eval "xcodebuild -scheme AppScheme -destination 'platform=iOS,id=$deviceUdid' install" #This line is not really working
################### Not working command ################
else
echo "Directory is not an xCode project directory!"
fi
else
echo 'It looks like there is no iDevice connected!'
fi
一切正常,除了安装在我的 iPhone 上。我得到了正确的设备名称,看起来好像找到了设备,但我在 iPhone 上看不到该应用程序。奇怪的是,如果我从 xCode 安装它,一切正常。
有人知道如何解决这个问题吗?
【问题讨论】:
标签: ios macos shell xcodebuild