Windows + Apple

The Challenges of Developing iOS Applications on a PC



·

Think iOS applications can only be created on a Mac? Well I’m pleased to inform you that you are mistaken! In fact I’ve been building iOS applications on a Windows machine exclusively for more than two years. It’s quite achievable but it’s not without its challenges, in this article I summarise some of the challenges I’ve faced developing iOS applications on a Windows computer and how I overcame them.

1. Native is not an option

This is the most obvious limitation of building iOS applications on a PC. You don’t have access to XCode so you can not build native iOS applications.

It’s a challenge to overcome certainly, but it’s not necessarily a bad thing. There’s a surprising amount of cross-platform alternatives out there for developing hybrid iOS applications, but perhaps the one gaining the most traction today is HTML5 mobile applications. I won’t go too in depth into HTML5 mobile applications in this article, but essentially a HTML5 mobile application uses web technologies to create a native-like mobile experience.

A HTML5 mobile application can not be an “iOS Application” by itself though – web apps can’t be submitted to the app store. But we can use a technology like PhoneGap to create a “native wrapper” around our HTML5 mobile app which will allow it to be submitted to the app store and installed on iOS devices. Which brings me to the next point…

2. PhoneGap Build is your only option

PhoneGap is exactly the tool you need to develop iOS applications on a PC, but there’s another problem: you can’t build iOS applications with PhoneGap on a PC (only on a Mac). What you can do though is use the PhoneGap Build service, which compiles your application in the cloud, so you’re not required to have the iOS SDK installed on your computer (which is what causes the problem with using a PC to build iOS apps). This also isn’t necessarily a bad thing, I like PhoneGap Build. It’s a great service and in most cases allows you to do anything that you could do with a local installation of PhoneGap.

There are some limitations though. Most notably you’re stuck with whatever the current latest version of PhoneGap available on PhoneGap Build is. They’re usually pretty quick at updating but it always lags behind recently released versions of PhoneGap.

In a local installation of PhoneGap you have access to the entire project structure, including plugins and so on. When using PhoneGap Build you’re restricted to just the ‘www’ folder, the resources that will be used to display the app itself (index.html, javascript files etc.). You can still use plugins with PhoneGap Build but you don’t have as much control over them.

I interviewed Simon Shepherd for my Beginners Guide to Sencha Touch eBook and he sums up the situation quite well:

I used the PhoneGap Build service in its early days, and did find it useful, but upload size limitations amongst other issues were frustrating. Again being something of a control freak I’ll always prefer to run my own builds locally if possible to protect from server downtime. I think the use case for PhoneGap Build is developing iOS apps on Windows and being able to still produce a build, without XCode. I’m not a fan of taking shortcuts and would advocate that other developers who can run OSX take the time to learn about Cordova from the command line, as this knowledge is invaluable long term.Simon Shepherd

It’ll probably take a little longer to get up and running initially, but if you have a Mac then it would be a good investment to learn how to use PhoneGap through the command line straight from the start. It’s worth noting though that the PhoneGap Build service has improved quite significantly since the interview, and the upload size limitations are now quite generous (especially if you’re using a paid account).

3. Creating certificates, keys and provisioning profiles

This was one of the issues I faced that I thought was really going to stump me. The ‘normal’ way to do this is to use a Mac and Keychain Access. It’s a bit of a process, but you can create the necessary certificate signing requests, provisioning profiles, keys and p12 files you need for iOS using OpenSSL.

You’ll have to run a few different commands and have access to the Apple Developer Program but it’s quite easy to do when you have a clear set of instructions to follow.

4. No iOS Simulator

The good thing about building HTML5 mobile apps is that you can do a lot of the testing and debugging through the browser. There comes a time when you need to install it on a device though to see how it behaves in the native environment, and to test any native functionality you’re using.

Without being able to simulate an iOS device, the only option is to install it on a real device. This combined with using PhoneGap Build can lead to a pretty large turnaround time for testing new features.

I’ve optimized this process as best I can by using PhoneGap Build through the command line and installing / debugging with GapDebug. This is still perhaps the most painful part of my development process though, and goes something like this:

  1. Finish feature
  2. Run build command (10-20 seconds)
  3. Wait for build to finish on PhoneGap Build (1 min)
  4. Download .ipa file (10 seconds – 5 minutes depending on how bad my Australian Internet decides to be)
  5. Drag and drop file into GapDebug

This delay can hurt my productivity quite a bit, I’ll often get distracted while waiting and may end up forgetting what I even wanted to test. So, if you have any ideas for improving this process I’m all ears!

5. Submitting to the Apple App Store

In the grand scheme of things this is a relatively minor problem, but I still find it to be one of the most frustrating.

It took a lot of trial and error to figure out how to build iOS applications on a windows machine, but every obstacle I came across I managed to figure out a way around it. I finally had my iOS application complete, built and ready for submission to the App Store – the final step in the process.

…and after all that, that’s where you get stuck. It is simply not possible to upload an application from a Windows computer to iTunes Connect because you need to use a program called ‘Application Uploader‘ which is only available on Macs.

After overcoming so many challenging obstacles, like creating certificate signing requests and keys using OpenSSL, the thing that finally stops you is simply uploading a file to the Internet. A process which takes about 2 minutes.

It’s not too difficult to overcome this fortunately. You can either just borrow a friends Mac for a couple of minutes or use a service like Macincloud to remotely connect to a Mac computer from your Windows computer.

Theres probably some other minor issues I’ve faced that I’m forgetting, but these are the major ones. Although some of these issues can be a bit annoying, it certainly doesn’t stop you from developing iOS applications on a Windows machine. If you have any tips for developing iOS applications on Windows, leave them in the comments below!

What to watch next...