【问题标题】:iPhone XCode Unit test framework build settingsiPhone XCode 单元测试框架构建设置
【发布时间】:2012-01-19 06:27:31
【问题描述】:

我正在尝试将单元测试添加到我的项目中,这就是我正在做的事情:

  1. 添加目标 -> Cocoa Touch 单元测试包
    product: AuthyTests
    company Identifier:com.authy.com
    project: authy

    所以生成的捆绑器标识符是:com.authy.AuthyTests

  2. 如果我运行 command+U(Product -> test) 就可以运行单元测试。

  3. 现在我从我的项目中添加一个库,所以 #include "otp.h" AuthyTests.h

  4. 添加一些对 AuthyTest.m ([Otp foo];) 的调用,我得到一个错误:


Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Otp", referenced from:
objc-class-ref in AuthyTests.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我尝试过的事情:

1.我尝试添加 authy.app 作为对 AuthyAppTests 构建阶段的 TargetDependencies 的依赖。

2.Targets -> AuthyTests -> BuildSettings -> Build Active Architechture Only -> Yes

我使用的是 xcode 4.2。我还尝试了这个网站上的所有内容:
http://twobitlabs.com/2011/06/adding-ocunit-to-an-existing-ios-project-with-xcode-4/

在 XCode 上设置 UnitTest 缺少什么?

【问题讨论】:

    标签: iphone objective-c ios xcode4.2


    【解决方案1】:

    听起来教程中的步骤之一没有被遵循。具体来说,步骤 4-6。我的猜测是捆绑加载程序的两个设置都关闭了。另一种尝试的可能性:

    在您的主要 Authy 应用目标中:

    • 将架构构建设置更改为:
      • i386
      • armv6
      • armv7
    • 还将“仅构建活动架构”更改为“否”

    其中一个应该强制主要的 Authy 二进制文件包含 i386。如果这仍然不起作用,那么是捆绑加载器设置行为不端。

    【讨论】:

    • 结果是步骤 4 导致了文件丢失错误(我们仍然可以在文件系统中找到该文件,这很奇怪)。我们今晚稍后再试...并报告,谢谢
    猜你喜欢
    • 1970-01-01
    • 2012-04-29
    • 1970-01-01
    • 1970-01-01
    • 2011-01-07
    • 2010-12-03
    • 1970-01-01
    • 2011-11-07
    • 2013-12-19
    相关资源
    最近更新 更多