問題xcodebuild failed with code 65解決記錄

搭建好appium環境,執行下列命令
py.test ios_simple.py
報錯:
xcodebuild failed with code 65

解決方法:
參考https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md

iOS真機測試必備軟件

  1. libimobiledevice,安裝命令:brew install libimobiledevice --HEAD
  2. iOS-deploy,安裝命令:npm install -g ios-deploy

自動配置
使用xcodeOrgId和xcodeSigningId:

{
	"xcodeOrgId": "<Team ID>",
	"xcodeSigningId": "iPhone Developer"
}

Team ID是蘋果給你的team分配的唯一的長度爲10的字符串。可以從開發者賬號中找到Team ID
手動配置
自動配置失敗後,需要手動配置。失敗原因通常是代碼簽名和項目配置問題。使用免費開發賬號時經常會出現失敗的情況,因爲免費賬號不能創建一個通配的描述文件。
步驟:

  1. Xcode打開待測項目
  2. General->Signing->Team, 選擇開發賬號
  3. 選擇待測試設備
  4. 點擊build按鈕

打包程序

  1. Product->Archive->Distribute App
  2. 由於使用的免費賬號,打包失敗

全手工配置

  1. 找到appium安裝路徑

$ which appium
/path/where/installed/bin/appium
  1. 找到WebDriverAgent路徑,運行下列命令
cd /path/where/installed/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
mkdir -p Resources/WebDriverAgent.bundle
./Scripts/bootstrap.sh -d
  1. Xcode修改WebDriverAgent.xcodeproj項目
open -a xcode WebDriverAgent.xcodeproj/

修改targets:WebDriverAgentLib, WebDriverAgentRunner
“General"標籤選擇"Automatically manage signing”,然後選擇"Development Team",“Signing Certificate"會自動生成。
Xcode創建描述文件可能會失敗,此時需要手動修改bundle id:
選擇target的"Build Settings"標籤,修改"Product Bundle Identifier”, 默認爲com.facebook.WebDriverAgentRunner, 將其中的facebook修改爲任意名字即可。
修改完成後返回"General"標籤,現在描述文件應該創建成功了。

  1. 構建項目
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=8d8524483cebc5fbc1c46c833c58c385009cad44' test

其中id爲手機的udid

  1. 成功結果如下
    在這裏插入圖片描述
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章