相关疑难解决方法(0)

如何以编程方式将构建文件添加到Xcode4?

我一直在试图弄清楚如何以编程方式将文件添加到Xcode4项目中,看起来AppleScript将成为可行的方式,但是我遇到了"缺失值"错误.

这是我得到的代码:

tell application "Xcode"
    set theProject to first project
    set theTarget to first target of theProject
    set theBuildPhase to compile sources phase of theTarget
    tell first group of theProject
        set theFileRef to make new file reference with properties {full path:"/Users/jeff/Projects/XcodeTest/XcodeTest/MyViewController.h", name:"MyViewController.h", path:"XcodeTest/MyViewController.h", path type:group relative}
        add theFileRef to theProject
    end tell
    --tell theBuildPhase to make new build file with properties {build phase:theBuildPhase, name:"MyViewController.h", file reference:theFileRef, target:theTarget, project:theProject}
end tell
Run Code Online (Sandbox Code Playgroud)

我已经尝试了注释掉的行而不是add-command,但这也不起作用(我得到"缺失值").

'添加'错误是:

error "Xcode got an error: file reference id …
Run Code Online (Sandbox Code Playgroud)

applescript xcode4

4
推荐指数
1
解决办法
1909
查看次数

标签 统计

applescript ×1

xcode4 ×1