(iphone) build xcode4 project from command line

I've used to build my project with xcodebuild -proj MyProject.xcodeproj -target MyTarget - configuration Debug -sdk iphonesimulator4.3

this works(it builds fine) but when I hit run in xcode, it recompiles.
(with xcode3, there was no need to rebuild once I build using command line)

I suspect xcode build use workspace/scheme rather than project/target.

How do I find out the workspace name that my current xcode project is using?

Thank you

  • edit
  • Chetan's links gave me directions what to look for.

    xcode4 stores build output in ~/Library/... whereas xcodebuild -project .. saves build output in project's build directory. (if you want the workspace capability, you can't use the build directory for build output)

    I created a workspace containing my project and ran xcodebuild -workspace myWorkSpace -scheme myScheme

    this saves build output in ~/Library/...../ Debug-iphoneos

    whereas xcode4 run button from the same workspace and same scheme saves output in ~/Library/..../ Debug-iphonesimulator

    any guess on why xcodebuild command uses Debug-iphoneos? :(

  • edit2
  • xcodebuild -workspace myWorkSpace -scheme myScheme -sdk iphonesimulator4.3
    specifying sdk solved it


    I know it isn't strictly the answer to your question, but you can configure the output directory of your build using the CONFIGURATION_BUILD_DIR environment variable.

    Source: http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/0-Introduction/introduction.html#//apple_ref/doc/uid/TP40003931-CH1-SW1

    链接地址: http://www.djcxy.com/p/50994.html

    上一篇: 将静态库链接到XCode 4中的iOS项目

    下一篇: (iphone)从命令行构建xcode4项目