寫在前面:
使用Xcode10漱挚,創(chuàng)建UnitTestingBundle和UITestingBundle后遏餐,運行Test方法后雾消,報錯“Test Failed”坊饶。具體控制臺Error泄伪,下記。
Failed to load test bundle from file:///private/var/containers/Bundle/Application/XXXXXX/XXXXX.app/PlugIns/XXXXXXTests.xctest: Error Domain=NSCocoaErrorDomain Code=3587 "dlopen_preflight(/var/containers/Bundle/Application/XXXXXX/XXXXX.app/PlugIns/XXXXXTests.xctest/XXXXXTests): no suitable image found. Did find:
/var/containers/Bundle/Application/XXXXX/XXXX.app/PlugIns/XXXXTests.xctest/XXXXTests: code signature invalid for '/var/containers/Bundle/Application/XXXXX/XXXXX.app/PlugIns/XXXXTests.xctest/XXXXXTests'
" UserInfo={NSLocalizedFailureReason=バンドルが壊れているか匿级、必要なリソースがありません蟋滴。, NSLocalizedRecoverySuggestion=バンドルを再インストールしてください。, NSFilePath=/var/containers/Bundle/Application/XXXXXX/
解決方法:
確保工程的Target和測試的Target的iOS Deployment Target的值相同