The success of iOS platform has spurred the creations of third party solutions that make make aspect of iOS development less painful such as in-app purchase, push notifications and backend integration provided by companies like Urban Airship and Parse. TestFlight is one such service. It was created to help facilitate your beta testing and lets you distribute your beta build over the air – made possible by the wireless app distribution model added in iOS4.
Let’s take a quick look at what TestFlight is all about and what they offer. For a complete overview of the latest and greatest of the service, you should of course sign up and visit the site directly. If you are already using TestFlight for your beta testing, you can also skip this and go straight to the next section.
1) Sign in after registration
2) Check the email on any of your test devices and login:
3) Tap Register Device to send your UDID over to TestFlight.
4) TestFlight sends back the provisioning profile over the air. What are you waiting for, tap Install!
5) Your device is now registered with your TestFlight’s database.
6) Now that you have registered some devices for testing, let’s submit a build to TestFlight.
7) We created the adhoc build in Xcode, saved the ipa file in Organizer, went to the folder where the ipa file is stored and dropped it here. Notice that it’s quite a bit of work — we will discuss how to automate this step without relying on Xcode later in this article, giving you a more pleasant test flight.
When your ipa file is done uploading, this is what you will see, and it’s where most of the power of TestFlight lies. Particularly, pay attention to the left pane: History shows you the upload history of each build of the app, along with feedback sent by testers (from within the app), crash reports, test session info (such as what your testers have tested and how long), etc.
(Names and photos have been blurred to protect the innocence)
9) Crashes has got to be the #1 concern when it comees to testing. Be sure to upload your dSYM file so TestFlight can make sense of the crash reports coming from your build.
10) This is an example crash report received from a test run of an app we worked on. Sexy, no?
At this point, assuming we have convinced you enough to start trying out TestFlight, here comes one last goodies. (Names and photos have been blurred to protect the innocence)
Step (7) and (9) requires that you mess around with doing the build and uploading your ipa file and dSYM file to TestFlight. Wouldn’t it be nice if this can somehow be taken care of as well? Well, you have chosen the right profession. All you need is create a shell script to automate this task and to save you time, we have created a script to do precisely that. If you are a gluten for punishment, you can skip the following and continue to use the good old Xcode way.
Quick HOWTO:
1) Save the script above to build.sh
2) chmod +x build-ipa.sh
3) ./build-ipa.sh
Let’s take a look at the script to automate the building and submission of our app to TestFlight:
#!/bin/sh ProjectPath="~/Projects/Test/" Target="TestApp" AdHocPath="build/AdHoc-iphoneos/" AdHocConfigurationName="AdHoc" DeveloperName="zitao xiong" ProvisionFile="8490865F-4F60-41BA-98EA-EA2E7B470CF2.mobileprovision" ipaName="testflightapp" api_token="your test flight api key" team_token="your test flight team token" notes="Beta build #1" // Step (1) xcodebuild -target "$Target" -configuration ${AdHocConfigurationName} // Step (2) xcrun -sdk iphoneos PackageApplication -v "${AdHocPath}${Target}.app" -o ${ProjectPath}${ipaName}.ipa --sign "${DeveloperName}" --embed ${ProvisionFile} // Step (3) pushd . cd ${AdHocPath} zip -r ${ipaName}.app.dSYM.zip ${Target}.app.dSYM/ // Step (4) popd curl -v http://testflightapp.com/api/builds.json \ -F file=@${ipaName}.ipa \ -F api_token="${api_token}" \ -F team_token="${team_token}" \ -F notes="${notes}"\ -F notify=True \ -F replace=False \ -F dsym=@${AdHocPath}${ipaName}.app.dSYM.zip // Step (5) rm ${AdHocPath}${ipaName}.app.dSYM.zip
Explanations:
Step (1) Here we use the xcodebuild command to build the project of our choice. Configure the target name and the configuration profile in the shell variables above it. In our case we are doing an adhoc build for our TestApp.
Step (2) We then use xcrun to create the ipa file. The command also takes care of embedding the provisioning profile into the ipa.
PackageApplication is a perl file locate at /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication
The rest should be self-explanatory.
NOTE: In case you are curious, ipa stands for iPhone Application. It’s technically a folder, though a folder is considered as a file in Unix.
Step (3) After the ipa file is generated, the script proceeds to zip up the dSYM folder. This way when TestFlight receives a crash report from your beta builds, it will be able to make sense of things in the event that you have configured the build setting for the build process to strip the debug symbols out of the build (e.g. to reduce file size).
NOTE: We use the Unix command “pushd .” to save where we are at before traversing into the build folder so we can return later with “popd”.
Step (4) We are now at ready to send the build off to TestFlight. Retract back to the project folder and use curl command to do the delivery. The parameters should be self explanatory so we won’t get into them.
Step (5) Finally we remove the dSYM zip file to keep things clean. You may choose to skip this step if you wish to keep it around for later use.
With the build uploaded to TestFlight, you can now notify your beta users to start testing it away! Thanks for flying with TestFlight and we hope you will fly with us again.
Disclaimer: This article is the result of our subject evaluation with TestFlight. We are in no way affiliated with TestFlight and have received no bonus miles in promoting their service.
没有评论:
发表评论