关于IOS系统上app自动化测试时,遇到的问题

问题:Cannot link directly with ‘XCTAutomationSupport’ because product being built is not an allowed client of it

描述:

完整报错:

Cannot link directly with dylib/framework, 
your binary is not an allowed client of /Applications/Xcode.app/Contents/Developer/Platforms
/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport 
for architecture arm64

对应版本:

xcode 14.0.1
iOS 16.0.2

在启动脚本时报错:Cannot link directly with 'XCTAutomationSupport' because product being built is not an allowed client of it即无法正常启动IOS控制模块,原因是该应用程序不可信,没有许可。

原因:

xcode版本和WDA不兼容
在appium1.X时容易出现问题,2.x相对稳定

解决

  • 方法1:更新最新版本的WDA,Appium已经修复了较高版本的xcode的兼容问题
  • 方法2:降低xcode版本到13左右

命令

  • 查看xcode版本:命令行:$ xcodebuild -version