appium入門指南(十)mac編譯webdriveragent 報錯彙總

一、xcode升級後編譯報錯

解決方法可以有兩種,一種是不使用New Build System,在File > Project/Workspace Settings中的Share Project/Workspace Settings 裏build system 將New Build System(Default)切換成Legacy build system。



其次是根據出錯信息,在新創建系統模式下,去除多餘的引用重建。

Info.plist

在 target -> Build phase > Copy Bundle Resource 中找到info.plist,移除

二、編譯證書彈窗輸入密碼不會消失

原因爲彈出了三個彈窗被重疊了,你輸入的可能不是最外層的彈窗,故輸入沒反應,解決策略:

把三個彈窗拉開,分別輸入密碼,點擊始終信任,直至彈窗消失(如果你到鑰匙串去配置始終信任會報錯: code signing is required for product type 'xxxxx' in SDK 'iOS 13.5')

 

三、高版本xcode編譯webdriveragent 報錯(Xcode11.5)

正常結果:

解決方案修改兩個webdriveragent代碼文件:

1、WebDriverAgent/PrivateHeaders/XCTest/XCTestCase.h

加入以下代碼到下圖中紅框位置

@property(nonatomic) BOOL shouldSetShouldHaltWhenReceivesControl;

2、WebDriverAgent/WebDriverAgentLib/Utilities/FBFailureProofTestCase.m

修改紅框中代碼26~36行爲下方內容,替換後的代碼如下圖
//  self.internalImplementation = (_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy proxyWithXCTestCaseImplementation:self.internalImplementation];
  if ([self respondsToSelector:@selector(internalImplementation)]) {
    // The `internalImplementation` API has been removed since Xcode 11.4
      self.internalImplementation =
        (_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy
                                      proxyWithXCTestCaseImplementation:self.internalImplementation];
    } else {
      // https://github.com/appium/appium/issues/13949
      self.shouldSetShouldHaltWhenReceivesControl = NO;
      self.shouldHaltWhenReceivesControl = NO;
    }

代碼修改之後再次運行即可,應該就可以成功了

四、xcode-select: error

運行xcodebuild遇到下面這個錯誤

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
執行 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer 就可以修復。See also: https://github.com/nodejs/node-gyp/issues/569

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章