Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building an iOS signing key for PhoneGap in Windows

Recently I've been asked by a number of developers how they can use PhoneGapBuild (PGB) to develop an iOS app when they only have a windows machine? The problem not being the development itself, but the provision of a key that PGB can use to build the iOS app.

One major problem is that PGB's faq gives instructions for using a mac to achieve this, and another being that Apple's documentation assumes the same.

So, can a key be created in windows without the use of a mac, and if so, what are the exact steps to do so?

like image 569
Software Engineer Avatar asked Dec 18 '13 03:12

Software Engineer


2 Answers

I always send people a link to an excellent article by Ian Devlin: http://www.iandevlin.com/blog/2012/11/phonegap/building-an-ios-signing-key-for-phonegap-in-windows.

The core of the solution is to do the following in windows using either windows openssl, or the cygwin variant:

openssl genrsa -des3 -out ios.key 2048

openssl req -new -key ios.key -out ios.csr -subj "/emailAddress=MY-EMAIL-ADDRESS, CN=COMPANY-NAME, C=COUNTRY-CODE"

Then, go to apple to request a cert, using the csr file you've just generated. This is pretty easy.

Generate a PEM and P12:

openssl x509 -in ios_development.cer -inform DER -out ios_development.pem -outform PEM

openssl pkcs12 -export -inkey ios.key -in ios_development.pem -out ios_development.p12

The end of Ian's explanation says,

The last file you need to generate is the provisioning profile, which again requires you to return to the Apple Provisioning Portal. There is plenty of documentation there on how to do this, so I won’t go into it here. Bear in mind that such certificates need to be tied to your iOS testing devices via their UDIDs, and again there is documentation on how to do this.

Once the provisioning profile is generated, download it (e.g. iOS_Development.mobileprovision) and save it in the same place as the other files. This file will also need to be installed on each of your iOS testing devices.

During the provisioning process you'll have to create a bundle id -- don't try to find it because it doesn't exist -- you are meant to make it up, and the easiest way is to use a wildcard id like com.yourcompany.*. If you're not using an ad-hoc distribution, which is recommended, you'll also be asked for the UUID for your iOS device. You can download a UUID app for free that will give you this, or you can just plug the device into windows and find the data in itunes (see this question). The app approach is preferable if you don't like itunes (and let's face it, if you're reading this then you probably don't).

Finally, you don't need to upload the provisioning file to your iOS device. You can use almost any QR Code scanner to load it and both the app and provisioning file will be installed.

like image 86
Software Engineer Avatar answered Oct 18 '22 11:10

Software Engineer


Check out http://www.macincloud.com/ for rent-a-mac by the hour. Preinstalled with Application Loader too, this is what I use to upload my apps built by PhoneGap Build. Easy enough even though you'd really think Apple would provide another option by now.

like image 43
pppontusw Avatar answered Oct 18 '22 09:10

pppontusw