问题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. 成功结果如下
    在这里插入图片描述
发布了53 篇原创文章 · 获赞 20 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/lylfv/article/details/88839066
今日推荐