Xcode:什么是目標和方案?

[英]Xcode: What is a target and scheme in plain language?


Yeah the title says it :-) What do they mean in plain English language? I really don't understand the explanation on Apple's website and I need to rename my target and I'm afraid that nothing works after that..

是的,題目說:-)它們是什么意思?我真的不理解蘋果網站上的解釋,我需要重新命名我的目標,恐怕在那之后什么也不能做。

3 个解决方案

#1


212  

I've added in Workspace and Project too!

我還添加了工作空間和項目!

  • Workspace - Contains one or more projects. These projects usually relate to one another
  • 工作區——包含一個或多個項目。這些項目通常相互關聯。
  • Project - Contains code and resources, etc. (You'll be used to these!)
  • 項目-包含代碼和資源等(您將會習慣這些!)
  • Target - Each project has one or more targets.
    • Each target defines a list of build settings for that project
    • 每個目標都定義一個項目的構建設置列表
    • Each target also defines a list of classes, resources, custom scripts etc to include/ use when building.
    • 每個目標還定義一個類、資源、自定義腳本等列表,以便在構建時包含/使用。
    • Targets are usually used for different distributions of the same project.
      • For example, my project has two targets, a "normal" build and an "office" build that has extra testing features and may contain several background music tracks and a button to change the track (as it currently does).
      • 例如,我的項目有兩個目標,一個“正常”構建和一個具有額外測試功能的“辦公室”構建,並且可能包含幾個背景音樂軌跡和一個按鈕來改變軌跡(就像現在一樣)。
      • You'll be used to adding classes and resources to your default target as you add them.
      • 您將習慣於在添加類和資源時向默認目標添加類和資源。
      • You can pick and choose which classes / resources are added to which target.
        • In my example, I have a "DebugHandler" class that is added to my office build
        • 在我的示例中,我有一個“DebugHandler”類,它被添加到我的office構建中
      • 您可以選擇將哪些類/資源添加到哪個目標。在我的示例中,我有一個“DebugHandler”類,它被添加到我的office構建中
      • If you add tests, this also adds a new target.
      • 如果您添加測試,這也會添加一個新的目標。
    • 目標通常用於同一項目的不同發行版本。例如,我的項目有兩個目標,一個“正常”的構建和一個“office”構建,該構建具有額外的測試特性,可能包含幾個背景音樂和一個按鈕來更改跟蹤(就像它目前所做的那樣)。您將習慣於在添加類和資源時向默認目標添加類和資源。您可以選擇將哪些類/資源添加到哪個目標。在我的示例中,我有一個“DebugHandler”類,如果您添加測試,它將被添加到我的office構建中,這也將添加一個新的目標。
  • 目標-每個項目都有一個或多個目標。每個目標都定義一個項目的構建設置列表,每個目標還定義一個類、資源、自定義腳本等列表,在構建時包含/使用它們。目標通常用於同一項目的不同發行版本。例如,我的項目有兩個目標,一個“正常”的構建和一個“office”構建,該構建具有額外的測試特性,可能包含幾個背景音樂和一個按鈕來更改跟蹤(就像它目前所做的那樣)。您將習慣於在添加類和資源時向默認目標添加類和資源。您可以選擇將哪些類/資源添加到哪個目標。在我的示例中,我有一個“DebugHandler”類,如果您添加測試,它將被添加到我的office構建中,這也將添加一個新的目標。
  • Scheme - A scheme defines what happens when you press "Build", "Test", "Profile", etc.
    • Usually, each target has at least one scheme
    • 通常,每個目標至少有一個方案。
    • You can autocreate schemes for your targets by going to Scheme > Manage Schemes and pressing "Autocreate Schemes Now"
    • 您可以通過計划>管理方案和按“自動創建計划”來自動為您的目標自動創建方案。
  • Scheme——一個Scheme定義了當你按下“構建”、“測試”、“概要”等時發生的事情。通常,每個目標都至少有一個Scheme,你可以通過使用Scheme >管理計划和按下“立即創建計划”來為目標自動創建計划

#2


41  

A target is an end product created by running "build" in Xcode. It might be an app, or a framework, or static library, or a unit test bundle. Whatever it is, it generally corresponds to a single item in the "built products" folder.

目標是在Xcode中運行“build”創建的最終產品。它可能是一個應用程序,或者一個框架,或者靜態庫,或者一個單元測試包。無論它是什么,它通常對應於“構建產品”文件夾中的單個項目。

A scheme represents a collection of targets that you work with together. It defines which targets are used when you choose various actions in Xcode (Run, Test, Profile, etc.) Often, you will have just one scheme, which uses the main app target for the Run, Archive, and Profile actions, and a unit test target for the Test action. If you were building two related apps, you might have two schemes that used the same unit test bundle but different app targets.

方案表示您一起工作的目標集合。它定義了在Xcode中選擇各種操作(運行、測試、概要文件等)時使用的目標,通常只有一個方案,它使用主要的應用程序目標來執行運行、歸檔和概要文件操作,以及一個單元測試目標來執行測試操作。如果您正在構建兩個相關的應用程序,您可能有兩個方案使用相同的單元測試包,但是不同的應用程序目標。

The main benefit of schemes (introduced in Xcode 4) is that they allow you to switch between running your app and your unit tests without needing to toggle the selected target.

方案(Xcode 4中引入的)的主要好處是,它們允許您在運行應用程序和單元測試之間切換,而不需要切換所選目標。

#3


39  

I am a visual person, hence to explain the concept I will be using a diagram.

我是一個視覺人,因此為了解釋我將使用的概念圖。

When you have multiple targets they can be one-to-one matched with Xcode's Run,Test,Profile actions, this concept defines a scheme

當您有多個目標時,它們可以與Xcode的運行、測試、配置文件操作一一匹配,這個概念定義了一個方案

enter image description here

A target is a version of your Project,i.e targets differ slightly in classes & resources to use during built time. A project can have multiple built time setting for separate distribution requirements.

目標是你的項目的一個版本,我。e目標在構建時使用的類和資源略有不同。項目可以為單獨的分發需求設置多個構建時間設置。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/12/17/72a03d13d22c22fc01bbf9f48271c877.html



 
粤ICP备14056181号  © 2014-2020 ITdaan.com