Xcode 10.2 单元测试运行报错:
xxx.app (346) encountered an error (Failed to load the test bundle. (Underlying error: 未能载入软件包“xxxxxTests”,因为它已损坏或丢失必要的资源。. 软件包已损坏或丢失必要的资源。. dlopen_preflight(/var/containers/Bundle/Application/4F72F249-4BF5-43E2-AD69-2E4BC06377FE/xxx.app/PlugIns/xxxxxxTests.xctest/xxxxxxTests): Library not loaded: @rpath/libswiftCoreMedia.dylib
Referenced from: /private/var/containers/Bundle/Application/4F72F249-4BF5-43E2-AD69-2E4BC06377FE/Boxue.app/PlugIns/xxxxxxTests.xctest/Frameworks/libswiftXCTest.dylib
Reason: image not found))
导致错误的原因是测试用的Target和工程Target的部署版本不一致导致的,Build Settings
中搜索deployment target
,确保和主工程中保持一致即可.
网友评论