无法加载捆绑UITests,因为它已损坏或缺少必要的资源。 尝试重新安装捆绑包
由于以下错误,我无法运行我的测试用例:
- 无法加载捆绑包“UITests”,因为它已损坏或缺少必要的资源。 尝试重新安装捆绑包。
- 未加载库:@ rpath / Alamofire.framework / Alamofire。
- 原因:未找到图像
尝试搜索和解决,因为两天但无法解决这个问题,有人可以帮助。
这是因为您的pod仅适用于您的Framework目标而不适用于测试目标。 将测试目标添加到podfile。
示例:
target 'MyFramework' do use_frameworks! pod 'Alamofire', '~> 4.5' end target 'MyFrameworkTests' do use_frameworks! pod 'Alamofire', '~> 4.5' end
我必须将我的框架的位置添加到目标> mytestTarget> Build Settings> Runpath Search Path下的Runpath搜索路径
] 3
- 去构建阶段
- 打开Copy Pods Resources并复制路径
- 粘贴从Copy Pods Resources复制的路径,并使用框架更改标记名称资源
- 清洁和建设
- 运行您的UITestsFile
如果您实际上正在使用Cocoapods,您可能只需要运行“pod install”,构建设置将自动更新。
你在这个问题中没有提到你使用CocoaPods。 可能你的Podfile与这个类似:
target 'MyApplication' do pod 'AFNetworking' target 'MyApplicationTests' do inherit! :search_paths end target 'MyApplicationUITests' do inherit! :search_paths end end
在这种情况下删除行inherit! :search_paths
inherit! :search_paths
来自所有子目标的inherit! :search_paths
:
target 'MyApplication' do pod 'AFNetworking' target 'MyApplicationTests' do end target 'MyApplicationUITests' do end end