如何从脚本中的 Xcode 项目中删除构建配置? [英] How do I remove a build configuration from an Xcode project from a script?

查看:28
本文介绍了如何从脚本中的 Xcode 项目中删除构建配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 AppleScript 来清理 Xcode 项目.我希望我的脚本删除一些与我团队中的其他开发人员无关的构建配置.

I'm currently using AppleScript to clean up an Xcode project. I'd like my script to remove some build configurations that won't be relevant to other developers on my team.

例如,如果我有Debug"、DebugTest"和Release",我希望脚本删除DebugTest".

For example, if I have "Debug", "DebugTest", and "Release", I would like the script to remove "DebugTest".

我目前正在使用以下脚本:

I'm currently using the following script:

tell application "Xcode"
open myXcodeProject
    set targetProject to project of active project document
    set targetConfigurations to build configurations of targetProject
    repeat with c in targetConfigurations
        if (name of c is equal to "DebugTest") then
            delete c
        end if
    end repeat
end tell

但是,当我运行脚本时出现以下错误,这让我相信我没有正确删除配置:

However, I'm getting the following error when I run the script, which leads me to beleive that I'm not deleting the configuration correctly:

Xcode 出错:AppleEvent 处理程序失败.(-10000)

谢谢!

推荐答案

试试这个...

tell application "Xcode"
    set targetProject to project of active project document
    tell targetProject
        delete (first build configuration type whose name is "DebugTest")
    end tell
end tell

这篇关于如何从脚本中的 Xcode 项目中删除构建配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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