Blog Details

In order to create an application for distribution through iTunes, the application either needs to be a native application developed with XCode (Apple’s free development program, how much does MS charge for Visual Studio?) with Objective C or it can be a Web Application created with HTML and Javascript, but it will need to be packaged up as if it were a native iOS application. There are a few ways this can be accomplished, you can use PhoneGap (Cordova), AppMobi or AppCelerator, in this article however, I’m going to walk through using PhoneGap, which is now Cordova.

If you want to follow along with me, you’re going to need a Mac, XCode 4.0 or later, an iOS Developer Account,  Sencha Architect 2 and Sencha SDK Tools and PhoneGap (Cordova), these can all be downloaded from the provided links. I will warn you ahead of time, this process is not for the faint of heart and will require some basic Unix knowledge.


Getting Your Environment Prepared

Step 1 - Download and install XCode. This can easily be obtained through the Mac App Store for free. You will need a Mac running Snow Leopard, Lion or Mountain Lion to use the app store.

Step 2 - Download Sencha Architect and install it using the instructions on the Sencha website, after that, download the SDK Tools from the Sencha website as well and follow their instructions. I will discuss some pitfalls I’ve experienced with Sencha in part 2 of this blog post.

Step 3 - Download and set up Cordova but don’t try and run their sample project yet. We are going to need to take care of some configurations within the Apple Developer portal first.

App ID’s, Provisioning Profiles and Certificates

Once you have all of this downloaded, installed and configured (in order to do this) you are going to need to go to the Apple Developer Portal and register for an account. The accounts are not free however, they will cost you $99 a year. I know, I know, Android doesn’t charge right? Well if you really feel like griping about this, I suggest you read this, this, and this and then maybe you will understand the value in paying for this and why Apple makes you jump through the hoops they do.

Ok, next comes setting up your application with Apple, in order to do that, you will need to follow these steps:

Generating a Certificate Signing Request

The first thing you will need to do is generate a certificate signing request, to do this, go into Applications > Utilities > Keychain Access. Once the application starts up, navigate to the preferences menu then click on the certificates tab, set the Online Certificate Status Protocol and the Certificate Revocation List settings to Off. Then after you close out of that dialogue box, you will need to go to Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority. In this dialogue you will need to enter the email address that is associated with your Apple Developer ID and make sure you select the option to Save To Disk in the radio buttons. Also check the box to Let me specify key pair information and click continue. I’m going to go ahead and save the request to my desktop so I can easily find it because I am going to need to upload this to Apple. The Key Pair Information screen will then come up and you need to make sure the Key Size is 2048 bits and the Algorithm is RSA, then click continue. You will get a confirmation message that the certificate request was created and then you can click Done. Once this is done, you will notice that your Private Key will be stored in your Keychain.

Next, you will need to go to the iPhone Developer Center and head to the iOS Provisioning Portal, you will need to navigate to the manage certificates screen. On the Development Tab you will need to click the Request Certificate button, this will take you to the upload screen for uploading the request we had just created. Click the upload button and it will upload and start the creation process. Once the certificate has been created, you can then download that certificate. Once it has been downloaded, double click it to install it to your keychain, once the dialogue box comes up, click “ok”.

After you have created your certificate and added it to your keychain, you will need to add your device to the provisioning portal, in order to do this, you will need to get your UDID by connecting your iOS device to your Mac and going into XCode where you will need to navigate to the summary once you have selected your device. Once you have your UDID, go back to the provisioning portal and click on Devices in the left hand menu, then you will see the Add Devices button, click that, name your device and copy / paste your UDID into the field for it.

Once the devices have been added, it’s time to create an App ID, navigate to the App Id screen in the provision portal and click New App ID, enter in a Description and a Bundle Identifier and Apple will create the App ID for you, it will look something like this - BSZY284XHR.com.domainname.senchatest .

The final step to setting up your app for testing is creating a provisioning profile. This profile must be installed on the devices you wish to test your application on. Navigate to the Provisioning screen, click New, then name your profile, check the certificate you want to use. Then select the correct APP Id from the drop down and select the devices you want to test the app on, then click submit. Once the profile has been created, you will need to download it and install it on the devices you wish to test with. To install it on the device, make sure the device is hooked up to your machine, then open XCode and navigate to the organizer screen. Then you can just drag the downloaded profile onto the device in the organizer screen. Once you do this, you may need to go into the Library > Provisioning Profiles on the upper left, then click refresh in the lower right. Follow through with the dialogues to refresh your Provisioning Profiles and certificates.

That’s it, if you have done this all correctly, you should be ready to go with getting your app packaged and on to an iOS device.

Part 2 coming soon.