Xcode 10 GM:XCUIScreen.main.screenshot() 因“dyld:惰性符号绑定失败”而崩溃

Posted

技术标签:

【中文标题】Xcode 10 GM:XCUIScreen.main.screenshot() 因“dyld:惰性符号绑定失败”而崩溃【英文标题】:Xcode 10 GM: XCUIScreen.main.screenshot() crashes with `dyld: lazy symbol binding failed` 【发布时间】:2018-09-13 09:03:30 【问题描述】:

当我从 XCTestCase 运行 XCUIScreen.main.screenshot()(在 Xcode 10 GM 中)时,测试会崩溃:

dyld: lazy symbol binding failed: can't resolve symbol _XCStringFromRect in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib/../../Library/Frameworks/XCTest.framework/XCTest because dependent dylib #12 could not be loaded
dyld: can't resolve symbol _XCStringFromRect in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib/../../Library/Frameworks/XCTest.framework/XCTest because dependent dylib #12 could not be loaded

【问题讨论】:

【参考方案1】:

Release notes 说 (Known Issues in Xcode 10 – IDE):

运行 ios 12 的设备可能无法截取从 Xcode 的设备窗口请求的屏幕截图。(42873539)

解决方法:在设备上截屏

我认为这一切都已连接,这是已知问题,所以总有一天会修复。

【讨论】:

以上是关于Xcode 10 GM:XCUIScreen.main.screenshot() 因“dyld:惰性符号绑定失败”而崩溃的主要内容,如果未能解决你的问题,请参考以下文章