【问题标题】:XCTest Error: The bundle couldn’t be loaded. Try reinstalling the bundleXCTest 错误:无法加载包。尝试重新安装捆绑包
【发布时间】:2016-04-14 17:59:47
【问题描述】:

在我通过 doint Product -> Test 运行 ProjectNameTests.m(空测试文件)后,项目成功构建,但它抛出并给我以下错误:

2016-01-10 11:25:32.677 xctest[66104:5611958] The bundle “ProjectNameTests” couldn’t be loaded. Try reinstalling the bundle.
2016-01-10 11:25:32.677 xctest[66104:5611958] (dlopen(/Users/XYZ/Library/Developer/Xcode/DerivedData/ProjectName-dnwnjlzdzxbcyydkxsumlvokmhvk/Build/Products/Debug-iphonesimulator/ProjectNameTests.xctest/ProjectNameTests, 265): Symbol not found: _FBSDKErrorArgumentCollectionKey
  Referenced from: /Users/XYZ/Library/Developer/Xcode/DerivedData/ProjectName-dnwnjlzdzxbcyydkxsumlvokmhvk/Build/Products/Debug-iphonesimulator/ProjectNameTests.xctest/ProjectNameTests
  Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Agents/xctest
 in /Users/XYZ/Library/Developer/Xcode/DerivedData/ProjectName-dnwnjlzdzxbcyydkxsumlvokmhvk/Build/Products/Debug-iphonesimulator/ProjectNameTests.xctest/ProjectNameTests)
Program ended with exit code: 83

我尝试从测试中删除 UIKit,更改 Match-O 类型,将模拟器切换到 iPhone 5 以及类似答案中建议的其他事情,但没有任何运气。有什么想法吗?

【问题讨论】:

  • 有没有人找到任何解决方案?在设置捆绑加载程序后,我仍然面临 UI 测试的这个问题。

标签: ios xcode unit-testing xctest nsbundle


【解决方案1】:

我刚刚遇到了类似的问题,结果发现 Xcode 项目的部署目标设置为 7.2,但 expecta 和 septa 需要 8.0 或更高版本。

【讨论】:

    【解决方案2】:

    退出代码 83 出现错误,无法识别添加到项目的外部库中的符号。

    在我的情况下,它是通过在测试目标常规配置中将“主机应用程序”设置为应用程序来解决的。我还检查了“允许测试主机应用程序 API”

    【讨论】:

    • 我没有在列表中显示该应用程序,它只显示一个,知道为什么吗?
    【解决方案3】:

    即使我遇到了同样的错误 我按照以下步骤解决了它

    将测试目标的Build settings中的Test Host设置为 $(BUNDLE_LOADER)

    实际上我正在尝试将单元测试添加到已经存在的项目中,我应该按照链接Adding Unit Tests to an existing iOS project with Xcode 4 中给出的方法中的过程进行操作,但我错过了该步骤

    【讨论】:

    • 我收到“无法加载捆绑包”错误,在尝试了 StackOverflow 的所有其他想法后,此更改对我的帮助如下:
    • 我收到“无法加载捆绑包”错误,在尝试了 StackOverflow 的所有其他想法后,此更改对我的帮助如下:下次我运行测试时,消息是“正在测试应该在模拟器中运行,而不是在设备中”。在模拟器中尝试后,测试运行良好....
    猜你喜欢
    • 2019-12-12
    • 2017-03-21
    • 1970-01-01
    • 1970-01-01
    • 2013-03-29
    • 2017-09-20
    • 1970-01-01
    相关资源
    最近更新 更多