Xcode "Build and Archive" from command line
Xcode 3.2 provides an awesome new feature under the Build menu, "Build and Archive" which generates an .ipa file suitable for Ad Hoc distribution. You can also open the Organizer, go to "Archived Applications," and "Submit Application to iTunesConnect."
Is there a way to use "Build and Archive" from the command line (as part of a build script)? I'd assume that xcodebuild
would be involved somehow, but the man
page doesn't seem to say anything about this.
UPDATE Michael Grinich requested clarification; here's what exactly you can't do with command-line builds, features you can ONLY do with Xcode's Organizer after you "Build and Archive."
I'd love for someone to come along and prove me wrong: both of these features work great in the Xcode GUI and cannot be replicated from the command line.
I found how to automate the build and archive process from the comand line, I just wrote a blog article explaining how you can achieve that.
The command you have to use is xcrun
:
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${RELEASE_BUILDDIR}/${APPLICATION_NAME}.app" -o "${BUILD_HISTORY_DIR}/${APPLICATION_NAME}.ipa" --sign "${DEVELOPER_NAME}" --embed "${PROVISONING_PROFILE}"
You will find all the details in the article. If you have any questions dont hesitate to ask.
With Xcode 4.2 you can use the -scheme flag to do this:
xcodebuild -scheme <SchemeName> archive
After this command the Archive will show up in the Xcode Organizer.
Here is command line script for creating archive and IPA example. I have an iPhone xcode project , which is located in Desktop/MyiOSApp folder.
Execute following commands one by one .
cd /Users/username/Desktop/MyiOSApp/
xcodebuild -scheme MyiOSApp archive
-archivePath /Users/username/Desktop/MyiOSApp.xcarchive
xcodebuild -exportArchive -exportFormat ipa
-archivePath "/Users/username/Desktop/MyiOSApp.xcarchive"
-exportPath "/Users/username/Desktop/MyiOSApp.ipa"
-exportProvisioningProfile "MyCompany Distribution Profile"
This is tested with Xcode 5 and working fine for me.
链接地址: http://www.djcxy.com/p/47392.html下一篇: Xcode的“建立和存档”从命令行