将XCTest导入现有项目 [英] Import XCTest in to existing project

查看:362
本文介绍了将XCTest导入现有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了一个新目标作为Cocoa Touch Unit Testing Bundle,命名目录为MyAppTests,实际框架未激活 - 它突出显示为红色

I added a new target as a Cocoa Touch Unit Testing Bundle, named the directory "MyAppTests", and the actual framework is not active-- it is highlighted red

当我添加通过构建阶段选项卡技术中的链接二进制文件框架,添加了一个新框架,而不是更新通过添加目标创建的框架。

When I add the framework by the 'link binary with libraries' in the 'build phases' tab technique, a new Framework is added, instead of updating the one that was created with adding the target.

当我走的时候为了运行代码,我会遇到各种各样的麻烦,从链接错误到其他未被识别的框架。

When I go to run the code, I then run in to all sorts of troubles, ranging from linking errors to other frameworks not being recognized.

如何激活添加目标时生成的XCTest.framework?请帮助,谢谢!

How can I activate the XCTest.framework that was generated when I added target? Please help, thank you!

推荐答案

XCTest.framework是Xcode用来启用的捆绑包

XCTest.framework is the bundle that Xcode uses to enable

#import <XCTest/XCTest.h>

要将测试用例添加到现有项目,请选择目标,右键单击>文件>新建>目标c测试用例类。然后在构建阶段,您可以添加XCTest.Framework。确保在创建测试用例时检查添加到目标框。

To add test cases to an existing project select the target, right click > file > new > objective c test case class. Then in your build phases you can add the XCTest.Framework. Make sure you check the add to target boxes when creating the test case.

这篇关于将XCTest导入现有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆