• 编译时.test文件报错无法解决的方法,关闭test编译


    有几次遇到从网上下载到的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目录。

  • 相关阅读:
    linux下删除修改时间为某天之前的文件
    SPRING-MVC访问静态文件,如jpg,js,css
    [转]Kafka/Metaq设计思想学习笔记
    C++类型转换总结
    蓄水池抽样
    Cracking the coding interview--Q2.4
    Cracking the coding interview--Q2.3
    Cracking the coding interview--Q2.2
    魅蓝note2在ubuntu14.04下mtp模式无法自动mount的解决方法
    让reddit/r/programming炸锅的一个帖子,还是挺有意思的
  • 原文地址:https://www.cnblogs.com/zxykit/p/5166022.html
Copyright © 2020-2023  润新知