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

查看:207
本文介绍了如何从脚本中的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 got an error: AppleEvent handler failed. (-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天全站免登陆