我一直想弄清楚如何以编程方式将文件添加到Xcode4项目,它似乎像AppleScript将要走的路,但我遇到“缺失值”错误。如何以编程方式将构建文件添加到Xcode4?
下面是我得到了代码:我已经试过被注释掉的行,而不是附加命令以及
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
,但是,这并不工作,要么(我得到“缺失值“)。
“添加”的错误是:
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"
“制作新的参考”不将文件添加到在Xcode文件的列表,但我也需要它被添加到该项目的目标,使我可以添加操作和插件到Xcode的文件中,无需首先选中复选框将其添加到“目标成员”中。
有时候,“你不能”表示:“我们不希望你做/知道仙大概,我相信你可以用某种方式来做,但他们会在商店里阻止它。 – mthama