Xcode創建的工程使用xcodebuild命令行編譯
1、確保xcodebuild能夠正常運行
如果使用xcodebuild命令出現如下錯誤:
could not stat active Xcode path '/Volumes/Xcode/Xcode.app/Contents/Developer'. (No such file or directory)
解決辦法:
xcode-select -switch 新的xcode路徑
例如:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
2、查看xcodebuild版本
xcodebuild -version
3、查看當前系統的SDK及其版本
xcodebuild -showsdks
4、cd切換到工程目錄,查看工程中的所有目標(target)
xcodebuild -list
5、編譯工程
默認編譯Release版本:
xcodebuild -target AddTest
編譯Debug版本:
xcodebuild -target AddTest -configuration Debug
6、clean清理工程
xcodebuild clean