jst*_*ast 4 applescript 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 \"251AD3431432472E006E300F\" of Xcode 3 group id \"251AD32C14324645006E300F\" of project \"XcodeTest\" of workspace document \"XcodeTest.xcodeproj/project.xcworkspace\" doesn’t understand the add message." number -1708 from file reference id "251AD3431432472E006E300F" of Xcode 3 group id "251AD32C14324645006E300F" of project "XcodeTest" of workspace document "XcodeTest.xcodeproj/project.xcworkspace"
Run Code Online (Sandbox Code Playgroud)
"make new reference"确实将文件添加到Xcode中的文件列表中,但我还需要将它添加到项目目标中,以便我可以从Xcode向文件中添加操作和出口,而不必先进行检查复选框将其添加到"目标成员资格".
我最终将此问题发送给xcode开发人员列表上的开发人员,我得到的响应实际上是"你不能".
| 归档时间: |
|
| 查看次数: |
1909 次 |
| 最近记录: |