http://webfrogs.me/2013/02/18/ios-automation/
xcodebuild -configuration debug
mkdir -p ipa/Payload
cp -r ./Release-iphoneos/PRODUCT_NAME.app ./ipa/Payload/
cd ipa
zip -r $FILE_NAME *
//************************************************************************************
xcodebuild -project ./xxx.xcodeproj -target xxx -sdk iphonesimulator6.1 -arch i386 -configuration Debug clean build
//Remember to amemd the "Valid Archetecture" to "xxx i386", or it will trigger an error: invalid architecture i386