Xcode编译出现Test Target源文件报错

有几次遇到从网上下载到的iOS开源代码编译报错,报错位置为Test Target的源文件,我就挺奇怪我又没做测试为啥会编译Test Target的源文件,之前的暴力解决方法是把Test Target直接删掉。

未免太暴力了点,删除了还不好恢复,我想换一个方法来解决。首先就是要弄明白为啥会编译Test Target源文件。摸索了一下,找到了原因:选择Xcode左上角Simulator/Device左侧的Scheme名,在下拉列表里选择Edit Scheme,随后选择Build选项,可以看到里面有Test Target,并且勾选了对应的Run选项。取消勾选Test Target的Run选项,再重新Build,就不会报错了。

至于Test Target源文件中的代码问题,以后再解决了。

关于Scheme、Target、Workspace的一些信息如下:

------------------Scheme------------------

An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.
You can have as many schemes as you want, but only one can be active at a time. You can specify whether a scheme should be stored in a project—in which case it’s available in every workspace that includes that project, or in the workspace—in which case it’s available only in that workspace. When you select an active scheme, you also select a run destination (that is, the architecture of the hardware for which the products are built)

可以看出Scheme和Targets可以是一对一,也可以是一对多的关系。同一时间只能有一个scheme是激活的。

------------------Target------------------

A target specifies a product to build and contains the instructions for building the product from a set of files in a project or workspace. A target defines a single product; it organizes the inputs into the build system—the source files and instructions for processing those source files—required to build that product. Projects can contain one or more targets, each of which produces one product.

------------------Workspace------------------

A workspace is an Xcode document that groups projects and other documents so you can work on them together. A workspace can contain any number of Xcode projects, plus any other files you want to include. In addition to organizing all the files in each Xcode project, a workspace provides implicit and explicit relationships among the included projects and their targets.

可以看出一个workspace里可以包含多个Xcode project。

使用Workspace的好处有:
1),扩展项目的可视域,即可以在多个项目之间跳转,重构,一个项目可以使用另一个项目的输 出。Workspace会负责各个Project之间提供各种相互依赖的关系;
2),多个项目之间共享Build目录。

参考:

Xcode Concepts

iOS:Xcode一些概念Target|Project|Build Setting|Workspace|Scheme[译]Xcode Concepts
猿题库iOS客户端的技术细节(一):使用多target来构建大量相似App

workspace & subProject & target

Xcode Multi-Target 管理多版本开发

时间: 2024-10-12 17:30:23

Xcode编译出现Test Target源文件报错的相关文章

resion 编译时,遇到java报错问题

checking if/usr/lib/jvm/java-1.7.0/bin/java -d64 is Java 1.6... no configure: error: Java1.6 required. /usr/lib/jvm/java-1.7.0/bin/java -d64 returned: java version"1.7.0_55" OpenJDK RuntimeEnvironment (rhel-2.4.7.1.el6_5-x86_64 u55-b13) OpenJDK

android编译framework架包运行报错 (转)

android编译framework架包运行报错 http://blog.csdn.net/cqupt_chen/article/details/8163632 最近在看frameworks里的源码,手痒了,便想改改看看效果,没想到改完后,模拟器却运行不起来了.        首先声明,我是用的android 4.0.3 ICS的源码,编译好后,利用编译好的镜像启动的模拟器,以前修改过里面的Launcher,将生成的Launcher.apk和Launcher.odex  push后是成功的.现在

XCode + IOS + Flutter真机调试报错

XCode + IOS + Flutter真机调试 报错:Could not build the precompiled application for the device. It appears that your application still contains the default signing identifier. Try replacing 'com.example' with your signing id in Xcode: open ios/Runner.xcwork

Android源码编译apk导入第三方包报错

报错内容如下: make: *** 没有规则可以创建"out/target/common/obj/APPS/ AndroidWFS_intermediates/classes-full-debug.jar" 需要的目标"out/target/common/obj/JAVA_LIBRARIES/ core_intermediates/classes.jar". 停止. 解决方案: 将项目复制到packages/apps目录下 新建Android.mk文件 LOCAL_

sublime text 2编译Python时打印中文报错的解决方案

当用sublime text 2 编译 python 文件时,若 print 打印出的中文时,控制台会报错: [Decode error - output not utf-8] 解决方案如下: 打开 sublime text 2 首选项 -> 浏览插件,进入 Python 文件夹,并找到 Python.sublime-build 文件. 打开如下: { "cmd": ["python", "-u", "$file"],

mysql5.5 免编译安装及脚本启动报错深入

Mysql安装环境简介: 最近在做MHA.已经安装完毕heartbeat和drbd,现在准备安装Mysql. Mysql安装目录:/opt/mysql Mysql数据目录:/data/mysql 备注:/data目录实际是drbd需要同步到备节点的磁盘分区 [[email protected] src]# df -h Filesystem     Size  Used Avail Use% Mounted on /dev/sda2      9.5G  2.0G  7.1G 22% / tmpf

ARM MDK 5.15能编译大容量的CPU,编译小容量的CPU报错问题

之前一直使用的是MDK 4.72,今天卸载了MDK 4.72(原因:你懂得!),重新装了个MDK 5.15,那么问题来了.编译的时候会报错.如图所示,26 Error(s). 我的CPU型号为STM32F103C8T6.当选择CPU为STM32F103ZET6时,编译成功.这是怎么回事呢?仔细检查了一下,原来是这么回事.由于我的工程模板是之前建的,在工程模板中启动文件选择的是startup_stm32f10x_hd.s,而这个启动文件对应的是大容量的芯片.STM32F103C8T6容量小,所以选

Yum编译安装Error Downloading Packages报错

1:执行yum clean all 清除缓存目录下的软件包及旧的headers: 2:接着执行 yum list重新列出所有已经安装和可以安装的软件包: 3:重新执行上述命令,发现yum编译成功: 注意:如果执行 yum list 报错,那就检查一下yum仓库是否有问题:并清除/etc/yum.repos.d/下多余.repo文件!

编译安装php5.6.30报错

[[email protected]_id01_u4_19.116 Software]# cat /etc/redhat-release CentOS release 6.8 (Final)...编译报错:make: *** [sapi/cli/php] Error 1 分析在编译安装php时出现 [undefined reference to libiconv_open']子类的错误信息,表示在 ./configure 没抓好些环境变数值,错误发生点在建立 [ -o sapi/cli/php]