【问题标题】:Error when adding s.frameworks 'XCTest' to podspec dyld: Library not loaded: rpath/XCTest.framework/XCTest将 s.frameworks 'XCTest' 添加到 podspec dyld 时出错:未加载库:rpath/XCTest.framework/XCTest
【发布时间】:2017-10-02 08:26:09
【问题描述】:

我有一个使用 XCTest 框架的 CocoaPod。要将 XCTest 导入 pod,我将 s.frameworks = 'XCTest' 添加到 .podspec 文件中。

我现在可以将 XCTest 导入 pod 类,但是在尝试运行示例项目时,我收到以下错误:

dyld:库未加载:@rpath/XCTest.framework/XCTest

引用自:/Developer/CoreSimulator/Devices/DEVICE_UUID/data/Containers/Bundle/Application/ID/TestPod_Example.app/Frameworks/TestPod.framework/TestPod

原因:图片未找到

【问题讨论】:

    标签: swift xcode8 xctest cocoapods-1.2


    【解决方案1】:

    找到了解决方案,当在 podspec 中添加 XCTest 框架时,请确保仅在 Podfile 中将其添加到您的 UITesting 和 Testing 目标中。这是因为XCTest 不能在已开发的目标上运行,只能在测试目标上运行。

    在您的 Podfile

    target 'MyProjectTestTarget' do
       pod 'PodFramework that includes XCTest as a dependency'
    end
    

    【讨论】:

    • 您好,您能举个例子,“仅在 Podfile 中将其添加到您的 UITesting 和测试目标”是什么意思?
    • 当然@BadmintonCat 我修改了答案。如果你能提出我的问题和答案,那就太棒了! ;)
    猜你喜欢
    • 2018-12-05
    • 2017-04-18
    • 2015-02-25
    • 2013-12-18
    • 1970-01-01
    • 2016-05-24
    • 2017-04-20
    • 2016-05-29
    相关资源
    最近更新 更多