How do I remove a build configuration from an Xcode project from a script?

老子叫甜甜 提交于 2019-12-08 04:50:54

问题


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.

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)

Thanks!


回答1:


try this...

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


来源:https://stackoverflow.com/questions/3693482/how-do-i-remove-a-build-configuration-from-an-xcode-project-from-a-script

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