命令列擷取mobileprovision檔案的UUID

來源:互聯網
上載者:User

標籤:

有時候我們需要擷取Provisioning Profile的UUID,一般情況下我們是雙擊mobileprovision檔案安裝,在老版本Xcode的Organizer視窗裡找到對應的UUID,新版本Xcode裡不知道為什麼這個路徑下就找不到uuid了,幸運地我找到了另外一個軟體:iPhone配置工具 + 生產力,這個軟體裡也能查看。

只是每次都要藉助於GUI工具來查看還是太麻煩了,更好的方法是用命令列,我找到了這個:0xc010d/mobileprovision-read

使用方法:

在Terminal下輸入下面的命令並斷行符號:

curl https://raw.githubusercontent.com/0xc010d/mobileprovision-read/master/main.m | clang -framework Foundation -framework Security -o /usr/local/bin/mobileprovision-read -x objective-c -

這條命令的作用是下載mobileprovision-read的源碼,然後編譯,最後把產生的二進位檔案mobileprovision-read放入到/usr/local/bin/路徑下。

現在你就可以執行mobileprovision-read命令來查看協助了。

mobileprovision-read -- mobileprovision files querying tool.USAGEmobileprovision-read -f fileName [-o option]OPTIONS    type – prints mobileprovision profile type (debug, ad-hoc, enterprise, appstore)    appid – prints application identifierWill print raw provision‘s plist if option is not specified.You can also use key path as an option.EXAMPLESmobileprovision-read -f test.mobileprovision -o type    Prints profile typemobileprovision-read -f test.mobileprovision -o UUID    Prints profile UUIDmobileprovision-read -f test.mobileprovision -o ProvisionedDevices    Prints provisioned devices UDIDsmobileprovision-read -f test.mobileprovision -o Entitlements.get-task-allow    Prints 0 if profile doesn‘t allow debugging 1 otherwise

查看UUID的命令是:

mobileprovision-read -f the-file-path -o UUID

測試可用。


之前也找了一些其它的方法來擷取UUID,並寫了下面的shell指令碼:

#!/bin/bashif [ $# -ne 1 ]then  echo "Usage: getmobileuuid the-mobileprovision-file-path"  exit 1fimobileprovision_uuid=`grep UUID -A1 -a $1 | grep -o "[-A-Z0-9]\{36\}"`echo "UUID:"${mobileprovision_uuid}

但是不知道結果為什麼為空白

更新:

根據這個(http://stackoverflow.com/a/10775025)答案下面的評論,找到了另外一種方法,是使用了蘋果的securityPlistBuddy工具,指令碼如下:

#!/bin/bashif [ $# -ne 1 ]then  echo "Usage: getmobileuuid the-mobileprovision-file-path"  exit 1fi# mobileprovision_uuid=`grep UUID -A1 -a $1 | grep -o "[-A-Z0-9]\{36\}"`mobileprovision_uuid=`/usr/libexec/PlistBuddy -c "Print UUID" /dev/stdin <<< $(/usr/bin/security cms -D -i $1)`echo "UUID is:"echo ${mobileprovision_uuid}

測試可行。




參考:

.mobileprovision files structure and reading - iDev blog

A command line tool to parse .mobileprovision file

0xc010d/mobileprovision-read

dwelch2344/mpParse

verb-ios/install-provisioning-profile.sh at master · JonathanPorta/verb-ios

命令列匯入p12認證檔案 | 大白良

ios - Can an Xcode .mobileprovision file be ‘installed‘ from the command line? - Stack Overflow



命令列擷取mobileprovision檔案的UUID

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.