【问题标题】:XCTest does not link iOS frameworksXCTest 不链接 iOS 框架
【发布时间】:2015-12-14 12:26:48
【问题描述】:

我正在使用xctest 在命令行上运行 iOS 模拟器单元测试。首先我构建目标:

xcodebuild -project "build/MyApp.xcodeproj" -target "MyApp Unit Tests" -configuration "Debug" -sdk "iphonesimulator" build

然后在测试包上运行xctest

xcrun xctest "build/build/Debug-iphonesimulator/MyApp Unit Tests.xctest"

这很好用,并且可以链接 /System/Library/Frameworks 中的框架,例如 Security。但是xctest 在我添加像 MobileCoreServices 这样的 iOS SDK 框架后立即中断,给我:

Library not loaded: /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices

单元测试在 Xcode 中运行良好,单元测试目标在其框架搜索路径中包含 $(PLATFORM_DIR)/Developer/Library/Frameworks

有人知道让xctest 找到iOS 框架的正确方法吗?

【问题讨论】:

    标签: ios xcode unit-testing xctest xcrun


    【解决方案1】:

    测试目标需要能够在 MyApp 的构建产品中寻找框架。您应该为测试目标添加一个框架搜索路径:

    $(CONFIGURATION_TEMP_DIR)/MyApp.build/DerivedSources
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-10
      • 1970-01-01
      • 1970-01-01
      • 2017-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-16
      相关资源
      最近更新 更多