使用Xcode 6模板使从属目标 [英] Make a dependent target with an Xcode 6 template

查看:72
本文介绍了使用Xcode 6模板使从属目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Xcode 5中,Dependencies键和一个整数数组将指示要创建从另一个已创建目标到当前目标的依赖性.

In Xcode 5, the Dependencies key along with an array of integers will indicate to create a dependency from another created target to the current target.

     <key>Dependencies</key>
        <array>
            <integer>1</integer>
        </array>

这表明将第一个目标作为当前(第0个)目标的依赖项:

This indicates make the 1st target a dependency on the current (0th) one:

但是,在Xcode 6中,甚至没有生成第二个目标,并且以下内容已记录到控制台:

However in Xcode 6, the second target does not even get generated and the following gets logged to the console:

9/23/14 3:26:58.520 PM Xcode[14870]: Invalid target dependency for template from /Users/paulb/Library/Developer/Xcode/Templates/Project Templates/Application/TestApplication.xctemplate

从调试器看来,Xcode 6期望使用字符串而不是整数.用字符串替换整数将摆脱控制台错误,并且将生成两个目标.但是,即使字符串是目标的名称,也不会生成依赖项:

From the debugger, it looks like Xcode 6 is expecting a string instead of an integer. Replacing the integer with a string will get rid of the console error and both targets get generated. However, the dependency does not get generated even if the string is the name of the target:

要使Xcode 6创建目标依赖项,需要在模板中做什么?

What needs to be done in a template to get Xcode 6 to create a target dependency?

完整.xctemplate 此处

Full .xctemplate here

推荐答案

Xcode 6需要Dependencies数组使用字符串而不是整数值.该字符串引用新TargetIdentifer密钥的值.

Xcode 6 expects a string instead of a integer value for the Dependencies array. The string refers to the value of the new TargetIdentifer key.

例如,第零个(从属)目标从以下更改:

For example, the zeroth (depending) target is changed from:

     <key>Dependencies</key>
        <array>
            <integer>1</integer>
        </array>

     <key>Dependencies</key>
        <array>
            <string>mylib</string>
        </array>

和第一个(从属)目标具有以下新密钥:

and the first (dependent) target has the following new key:

     <key>TargetIdentifier</key>
        <string>mylib</string>

这篇关于使用Xcode 6模板使从属目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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