This is a a blog post from Thomas Dohmke, CEO at Codenauts UG, creators of HockeyApp. HockeyApp allows you to distribute your betas and collect live crash reports for beta and release apps on Mac OS X, iOS and Android. Before founding Codenauts UG, Thomas worked in the automotive industry and learned the importance of efficient processes. Now he is bringing the same quality to the development of mobile apps.

Don’t Repeat Yourself

One of the most important principles in software development is “Don’t Repeat Yourself (DRY)”. First introduced by Andy Hunt and Dave Thomas in their book, “The Pragmatic Programmer“, it was intended not only for programming, but for all parts of the development process: “Database schemas, test plans, the build system, even documentation.”

The standard build system for iOS development is Xcode. To test a new app or new feature in the simulator or an actual iPhone, I click “Build & Run,” and the app launches after a successful build. When I decide to send this as a beta version to a couple of testers, things get more complicated. If I haven’t already, I need to create a distribution certificate, enter the Unique Device ID (UDID) of all testers’ devices, and put them into a provisioning profile. The certificate and profile are then used by Xcode to sign the build.

Every time we buy a new device or find a new tester, I need to change this profile and make sure that all members of the development team get it on their machines. This is a cumbersome and error-prone process.

What if we instead use the Mac Mini in the corner of our office as a build server? Its main purpose is to connect to our printers, and we rarely print anyway. Now it should pull our project from Bitbucket, build the app, sign it, then upload it to HockeyApp for distribution and crash reporting.

Five Steps to Mobile Automation

We need five steps to make this work:

  1. Install Xcode from the App Store. The current version is 1.68 GB, so feel free to grab a coffee while the download runs.
  2. Pull our project from the git repository, copy the distribution certificate and provisioning profile to the machine, and see if it successfully compiles.
  3. Install Bamboo. It comes as an OS X Installer download, so the setup is easy. When it’s done, I can open the admin interface in my browser by going to http://localhost:8085
  4. Create a new build plan. Enter the plan name and key; then, configure the source repository. I select Bitbucket, add my credentials, load the list of repositories, and select our project. We push new code to the branch “develop” and merge to “master” for beta builds, so I choose the “master” branch for polling.
  5. In the next step, I add 4 jobs to this plan:
    • Source Code Checkout: Select the repository which was configured above. I prefer to do a clean build on each run, so I set the corresponding checkbox.
    • Xcode Build: This task is part of the Xcode plugin which is available from the plugin center. It uses xcodebuild to compile the project and also does all the code-signing stuff. Fill out the form as shown in the screenshot.

    • Zip dSYM: The dSYM bundle is needed for crash symbolication, so a command task compresses it to a zip file which can be uploaded to a server.
    • Upload to HockeyApp: This task is also part of the Xcode plugin. Its configuration is simple: enter the paths to the build results, enter the paths to the HockeyApp API token, and decide if testers should be notified via email.

Now every time we merge our code into the “master” branch, Bamboo will create a new build of our app and upload it to HockeyApp. HockeyApp will then notify testers via email. They will also get an alert if they open an old version of the app, and can directly update from within the app.

Easy Crash Reporting

If the app crashes, the tester is asked to send the crash log to HockeyApp. As Bamboo has uploaded the dSYM bundle together with the app, HockeyApp can symbolicate the crash log, i.e. transform binary addresses into class, method, file name, and line number. It groups similar crashes into so called crash groups so that we can easily identify hotspots in our app.
Create issues from crash reports
HockeyApp also integrates with JIRA, so it automatically creates a ticket for each crash group. With JIRA Mobile Connect, developers can also download a combined SDK and enable their users to give feedback directly from within the app. This works for both beta versions and apps which are deployed to the App Store.

Save Time and Prevent Errors

With this, we have a DRY process with source code management, project tracking, continuous integration, distribution, and crash reporting. It saves time and prevents errors, so we, developers, can fully focus on the things we love: designing and programming new apps with new features.

Get Me Started

HockeyApp
Get started with a free trial by signing up at HockeyApp today.

New to Bamboo?
Download Bamboo and get started with a free trial.

Xcode
Once you have Bamboo installed, download the Xcode plugin from the Atlassian Plugin Exchange to start building.

Fresh ideas, announcements, and inspiration for your team, delivered weekly.

Subscribe now