Build:
xcodebuild -exportArchive -exportFormat ipa \
-archivePath "/Users/username/Desktop/MyiOSApp.xcarchive" \
-exportPath "/Users/username/Desktop/MyiOSApp.ipa" \
-exportProvisioningProfile "MyCompany Distribution Profile"
Archive:
xcodebuild -project <ProjectName.xcodeproj>
-scheme <ProjectName>
-sdk iphonesimulator
-configuration Debug
-destination "platform=iOS Simulator,name=<Device>,OS=9.3"
clean build