Skip to content

Instantly share code, notes, and snippets.

@jstedfast
Created September 27, 2011 19:18
Show Gist options
  • Save jstedfast/1245960 to your computer and use it in GitHub Desktop.
Save jstedfast/1245960 to your computer and use it in GitHub Desktop.
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/fejj/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: "missing value"
if I use the --add instead of the "tellTheBuildPhase..." line, I get:
error "Xcode got an error: file reference id \"251AD34D14325907006E300F\" 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 "251AD34D14325907006E300F" of Xcode 3 group id "251AD32C14324645006E300F" of project "XcodeTest" of workspace document "XcodeTest.xcodeproj/project.xcworkspace"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment