Rebuilding CommuterPal with Azure Functions and CosmosDB

A few years ago I built an iOS called Commuter Pal. I never actually launched the app, since I tried to do *way* too much in terms of route planning and intelligent alerting. Since I didn’t actually commute myself, it was not something I could field test.

Fast forward to 2017 and I’ve been commuting for about six months now. I’ve tried a few different apps to help keep me ahead of delays, but most of the apps are aimed at the entire network and have loads of bells and whistles, so I gave up using them as they just didn’t help. Most of the time I’m already on the platform before I learn of a signal failure or ill passenger.

To coincide with the fact I’ve started wearing my Apple Watch again, I’ve decided to try and bring Commuter Pal back to life with a more simple goal; a watch complication that tells me if my route is clear or blocked.

My choice of tech is predictable – iOS (Objective-C) and .Net. This time, instead of my usual WebAPI approach, I’m going to try and build the whole thing with CosmosDB and Azure Functions. I’m not really sure how it will work, but I think that all phone interactions can be powered by HTTP bound Functions and calls to TFL for updates can be done using Timer based Functions. Throw in a queue here or there and an Azure Notification hub and we should be in business.

I’ll try and document the process as I go along.

If you’re an iOS user and commute using the London Underground, I’ll be making this app available for beta testing, so if you’re interested in taking a look, let me know!

Apple Pay with iPhone 5 and Apple Watch

Now that Apple Pay is live in the UK, I thought it was time to try it out. Initially I thought Apple Pay was limited to the iPhone 6 and that I’d be left out in the cold (until they release a new 4″ version of the iPhone), but I was informed it works with the Apple Watch on its own.

This isn’t the most obvious thing and the option to set it up isn’t the most obvious either! I’ve taken a few screenshots to show you how far I got. Which, sadly, wasn’t very far.

I’m running iOS 9, beta 3 and Watch OS 2, beta 2.

First, open the Watch app on your iPhone.


Navigate to the Wallet app (or Passbook in iOS 8)


You should now see an option to Add Credit or Debit Card. When I clicked it, I simply got an error. Probably due to the fact I’m running beta software.

IMG_3250If you get it working, please let me know. I’m tempted to switch bank just to avail of this platform. Barclays, it seems, are pushing their own bPay technology. I suspect they’ll keep that for a few months and then support Apple Pay anyway.

How to view your colleagues’ schedules at a glance!

I spent some time over the weekend tweaking the UI for Peopler. I think this version looks a little clearer and more distinct. I’ve also added a new feedback page to this version and I’m keen to see whether this makes a difference.

iOS Simulator Screen Shot 9 Feb 2015 10.16.26

Peopler lets you view the calendar’s of other people using Microsoft Exchange. You don’t need shared calendars or anything complicated, just the person’s email address.

Peopler is available to buy in the App Store

This new version, with the updated UI, should be approved within the week!

Job Tracker beta testing

It’s been a week since my little brother, AKA beta tester prime, started using my Job Tracker app on his Android phone.

He’s an electrician and travels around doing work at a mixture of sites, commercial and residential, so an app that let’s him record accurate details of the work he has done could be very helpful. I delivered a build of the app to him using Google’s Alpha delivery mechanism, which is very simple I must say.

As with all apps, there were plenty of head scratching issues to work out. This proved to be very challenging, since my brother is in Ireland and I’m in England. I had two main issues, both beacon related.

It wasn’t detecting the beacons.

Since the app is build around the concept of iBeacon monitoring, this was quite a big one! I posted an Estimote beacon to my brother for the purposes of this beta testing. He basically placed it in a room and walked in and out of the room. The broadcast radius of the beacon was very low, so I was puzzled as to why it wasn’t recording the stops. There was no way to get an insight into the app (to read the logs) so I was diagnosing the issue blind.

They possible causes:

  1. The beacon monitoring wasn’t working at all.
  2. The location detection was generating an error and being swallowed.
  3. The call to my API was failing.

I ruled out number 1 by adding lots of Toasts to the Background Service. This allowed my brother to determine that it was detecting the beacons.

Number 2 was an act of faith. I had to assume that since the permissions were requested and the location services were switched on, that this was working okay.

In the end, it was a silly omission on my behalf. I had just updated the backend and added authentication. I was missing the Authorization header on one of the requests, so the app couldn’t successfully function. D’oh!

Sometimes it would fail to record an entry or exit

This issue proved to be more subtle. During the day, the app would work perfectly, or not at all. In some cases it would stop detecting the end or exit events. There were two possibilities. Either my code was crashing or Android was killing the Background service and not restarting it. I added lots more exception handling to the Background service and included an alert dialog so my brother would know if the service crashed. After a day’s use, this dialog never appeared, so I ruled out developer negligence. I switched the service over to a Foreground one. This eliminated the issue, but left me with a permanent dialog. I’ll revisit this once the app’s functionality has been improved.

There were, of course, other bugs in my code. Most very simple to squash.

This week should bring a full 5 days of uninterrupted testing and help me determine if the app is useful, annoying, pointless or somewhere in-between. I just completed an iOS version too and that’s being deployed to another brother. He’s a mobile mechanic, so this app is suitable for him too. I’ve got a beacon sitting in a Jiffy bag ready to post to him!

I’ve had an idea for a home-delivery beacon platform too 🙂


iOS Enterprise managed app configuration

With the release of iOS 7, Apple introduced support for managing an app’s configuration using a Mobile Device Management system. This allows enterprises to deploy apps and then control their configuration centrally. You could provide URLs or enable and disable features with the push of a button.

An app that supports managed configuration just needs to read a particular key, from NSUserDefaults. This yields an NSDictionary which contains all the settings pushed to the app via the MDM. For my work with Roomr, I choose to support managed configuration so that the Exchange URL could be set and modified with ease.  The code changes are very simple.

Testing managed configuration is another kettle of fish. You can provide the configuration in one of two ways. Firstly, you can provide the configuration when the app is being installed or you can provide it after the app has been installed, effectively updating it.

To accomplish this, I used my own product, TestMDM. TestMDM aims to replicate many of the features of a MDM without replicating the large cost and complicated setup. It’s aim is to make it possible to test enterprise features without having to suffer the expense of purchasing an MDM. It also means you don’t need to trick an MDM provider into giving you a trial and then spending hours getting that setup.

To test my configuration, I used TestMDM to first install my app. Once I had successfully installed it, I then pushed configuration to it


I just click Queue and TestMDM takes care of the rest. I can debug my iPhone app at the same time and ensure the configuration is detected and loaded correctly.

If you’re interested, please check out TestMDM – I’m making improvements all the time so if a particular feature is missing, let me know and I’ll add it to the roadmap.

For developers who want their apps in large enterprises, supporting iOS7’s Enterprise features, such as single sign-on and managed configuration, is a no-brainer. Hopefully you’ll find TestMDM useful. If you have any questions, please get in touch!

Testing iOS Enterprise features without an MDM

Recently, I deployed a special version of Roomr to a large enterprise customer for inclusion in their Enterprise App Store. Part of the arrangement was that I support two enterprise features; Single Sign-On and Managed App Configuration.

This, on the face of it, was an excellent deal. I watched some WWDC videos on preparing apps for Enterprise and had managed to land a face to face meeting with the head of IT at this company. It seemed like a small amount of code would need changing in exchange for a tremendous financial opportunity (the company in question has over 120K employees world wide).

However, things are rarely as easy as they appear.

I immediately discovered, to my dismay, that the Managed App Configuration feature required a full MDM (mobile device management) platform to operate correctly. I searched the internet looking for MDM software that I could download and use for testing, but sadly I couldn’t find any. All of the major providers offer trial versions, but you have to get in touch with them etc. etc. As I wasn’t going to buy their software, they were understandable disinterested.

I knew I needed to test my software before releasing it, so I needed another approach.

I decided to build the software I needed to complete my testing. After some prelimiary research I discovered I needed to be a member of the Apple iOS Enterprise developer program. At £185, this was a hefty amount, but the potential earnings from a successful enterprise deployment made it worth the investment. I handed over my credit card information and got Cold Bear Ltd registered within the Enterprise program.

After getting the MDM protocol documentation (thanks to Peter Marcos at Apple for helping with this), I got to work. After much hair pulling, use of SSL and prolific swearing, I got a basic MDM solution working. Another few hours and I had tested my Enterprise code. I packaged up the IPA and emailed it to my client.

After the dust settled, I got an email from another developer who was having trouble testing the same Managed Configuration feature. After establishing that he would be willing to pay money for a simple way to test this feature (his MDM wasn’t working) I started refactoring my code.

After more swearing and hair pulling, TestMDM ( was born! TestMDM offers basic MDM functionality in a time-boxed fashion. You might want to test your app for an hour or a week and you only pay for the time you need. I hope this strikes a balance between the time and cost purchasing an MDM and the need to test some features quickly and effectively.

It’s almost ready for launch. I’m just putting the finishing touches to the device enrolment functionality to make it as easy as possible.

So, if you’re an enterprise developer or thinking of getting into enterprise development, TestMDM might be of use to you. If you’d like to know more, please drop me an email – and I’d be happy to have a chat about what you need for enterprise development.


PS The name TestMDM is most likely to change Smile If you have any suggestions, I’d love to hear them.

Importing Apple Certificate to Windows

When generating certificates for use with iOS, be it push notifications or Passbook, it’s sometimes necessary to take these certificates and export them, so they can be used on a Windows machine. If you want to generate the certificates using only Windows, please read my post on that subject.

The process of exporting an existing certificate is thankfully straightforward.

First, open the Key Chain assistant and locate the certificate you want to export.

Screen Shot 2012-10-22 at 07.16.59

Click the small arrow beside it. This should expose the Private Key component. If this is missing, your certificate is not complete.

Screen Shot 2012-10-22 at 07.17.22

Select both of these rows and right click.

Screen Shot 2012-10-22 at 07.17.53

Choose “Export 2 items…” – Don’t worry, it will only generate one file. You’ll then be promoted for a password for your Private Key.

Screen Shot 2012-10-22 at 07.18.36

Finally, choose the location.Screen Shot 2012-10-22 at 07.18.29

You now have the exported certificate. Copy the file onto the Windows machine you want to import it to. Double click on the file to launch the import wizard. This certificate should now be ready to use!

Generating an Apple iOS certificate using Windows

When using any services for your iOS device such as Push Notifications, you need to generate a certificate. It’s quite simple when using Mac OS X as all Apple’s instructions are geared towards it. What do you do, however, if you’re using a Windows machine. There are a few more steps involved, but the whole process is simple enough.

Before you get started, ensure that you have IIS installed on your machine as we’ll need that to generate the certificate request.

To get started, open the Provisioning Portal on Apple’s developer site and add whatever certificate you need. You’ll be promoted with this dialog.


Open the IIS manager, select the machine name on the left hand side and look for the Server Certificates icon in the Features section and double click.


Opening the Server Certificates feature will create a menu on the right hand side of the screen. The second option in that menu list is the “Create Certificate Request”. This will allow us to generate the file that Apple requires in order to generate our certificate.


Click this option opens the Request Certificate wizard.


Fill this form out with some basic details. The Common name I always fill with my email address, but put whatever values you feel are appropriate here.


Next, select the type of request. I always select a key length of 2048. I don’t know what OS X does here, so if anyone knows what size of certificate they request, please let me know in the comments. Click Next to continue.


Next, just select a location to save the request to and hit Finish. Return to the Apple provisioning portal.


Choose the file you’ve just created and hit Generate.


Apple will now generate the certificate file.


We now have the certificate, but this doesn’t contain the private key. We need to complete the process. Hit download and save the cert somewhere. Return to IIS’s Server Certificate Feature. In the menu on the right hand side, as before, you’ll see an option called Complete Certificate Request.


Select the Cert you’ve just downloaded and give it a friendly name. Hit OK. This step will effectively join our Certificate Request with Apple’s certificate to produce a full certificate with both public and private keys. You should now see the certificate in IIS. NOTE: Please ignore the typo in the Friendly name field. Thanks to @nickg_uk for pointing it out!.


You can also choose to export this certificate. If you do, choose the PFX file type to include the Private Key. Once you’ve exported it to a file, you can import it into your certificate store for later use.


I hope this has been helpful and easy to follow. If you have any comments or suggestions on it, please use the comments section below!

Apple, please stop talking utter BOLL&*KS

Anyone following the Apple announcement yesterday, should have been dismayed by Apple’s on-going, incredibly stupid  use of percentages to drive home how good they are.


When comparing Lion’s adoption rate, they threw up this slide.


How can anyone fall for this shite? A simple search on Bing will reveal figures that put this comparison into context. Sure the percentages may be correct, but that means nothing! Large percentage changes on small numbers are not impressive.

Let’s consider the figures to date: 6 million copies of Lion have been downloaded. That’s an impressive figure, no doubt about that. But Microsoft have sold over 400 million copies of Windows 7. That sort of leaves Lion in the dirt. Flipping the headline, it would read.

Microsoft ship 6000% more copies of Lion that Apple.

Or, to put it another way, assuming a linear adoption of both Lion and Windows 7,

Microsoft sell 6 times more Windows 7 licenses per week than Lion.

Apple don’t sound as impressive now. So my advice to Apple. Cut the bullshit. You’re not fooling anyone! Your OS is doing well (better than Linux I imagine) and you’re making buckets of money,