Make a dependent target with an Xcode 6 template

删除回忆录丶 提交于 2019-12-11 22:14:55

问题


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>

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

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

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:

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

Full .xctemplate here


回答1:


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>

to

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

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

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


来源:https://stackoverflow.com/questions/26005871/make-a-dependent-target-with-an-xcode-6-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!