报错信息如下:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_XCElementSnapshot", referenced from:
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBIsVisible in XCUIElement+FBIsVisible.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBUID in XCUIElement+FBUID.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_WebDriverAttributes in XCUIElement+FBWebDriverAttributes.o
objc-class-ref in XCUIElement+FBWebDriverAttributes.o
objc-class-ref in XCUIElement+FBUtilities.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBAccessibility in XCUIElement+FBAccessibility.o
l_OBJC_$_CATEGORY_XCElementSnapshot_$_FBScrolling in XCUIElement+FBScrolling.o
...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因分析:苹果将XCElementSnapshot从XCTest.framework移动到了私有的XCTAutomationSupport.framework
造成文件无法import
结果办法:
在文件WebDriverAgent.xcodeproj/project.pbxproj中增加部分代码,增加途中绿色部分,具体增加的代码查看webDriverAgent作者在git中的提交
https://github.com/facebook/WebDriverAgent/commit/c4da863b9c8d6d076ba74bf1ff58b47ef56dd2fa#diff-7610c17549f7cb63943c12afdfd7ba64R613