Archives for the ‘Apple’ Category

1 Oct 2014

Appcelerator Tip: Switch between iOS SDKs for mobile app development

Thanks to Apple forcing my hand by auto installing Xcode 6, I had to quickly manage multiple versions of Xcode on my mac for Appcelerator mobile development.

Why multiple versions?

Xcode 6 has the iOS 8 SDK and Simulator by default. For some reason, I couldn’t get it to include the iOS7 SDK, which is what I require for my current development projects. This meant that I needed Xcode 5 back on my machine. I was quite nervous to delete Xcode 6 and replace it with Xcode 5 again, so I decided to install multiple versions of Xcode instead.

My first attempt failed

My first attempt was to do the following (Note: Here’s my blog post on how to achieve the below-mentioned):

  • Download Xcode 5.1.1 from the Apple Developer Center
  • Extract the 7.1 SDK and Simulator from Xcode 5.1.1 and paste it into Xcode 6
  • Restart Titanium Studio

This used to work in the past, but not this time. I kept getting random errors that I  haven’t seen before.

My second attempt succeeded

Thankfully, there’s more than 1 way to skin a cat. The following worked for me:

  • Download Xcode 5.1.1 from the Apple Developer Center Website (I named the file “xcode_5.1.1.dmg“)
  • Double click the DMG file and drag the “” icon on to the “Applications” icon.
  • When prompted if you want to “Replace” or “Keep Both” files, choose “Keep Both“.



  • Once the copy is complete, navigate to the Applications Folder and rename the new to “”


Now, what we need to do is tell Titanium which Xcode to point to. By default, Titanium looks at the default “” file in the Applications folder. In this scenario, we want Titanium to point to the “”.

To achieve this, do the following:

  • Open Terminal
  • Type in “sudo xcode-select -switch /Applications/”
  • Restart Titanium Studio
  • In the Top Menu, navigate to “Titanium Studio > Preferences > Studio > Platforms > iOS”
  • Next to iOS SDK Home, click on the “Refresh” button.



And that’s it. Hopefully this will do the trick for you as well.

Till next time
2 Sep 2014

Bluemix iOS Push Notifications Tutorial: Part 3 – The APN Lifecycle

In this blog post, I provide a brief overview of Apple’s Push Notification Lifecycle and where IBM Bluemix fits in.

Quick Notes

  • This Blog Post is Part 3 of a Tutorial Series on IBM Bluemix and iOS Push Notifications.
  • My aim in this Blog Post is to help you understand Push Notifications when it comes to Apple Mobile Devices (iPhones/iPods/iPads).


When it comes to including Push Notification functionality in your iOS mobile app, the functionality itself is quite simple and straightforward. It’s understanding the lifecycle of the Apple Push Notification Service (APNS) that’s a bit daunting. What i’ve done below is divide this lifecycle into smaller topics that I trust will have you understanding enough of how the entire service works, to allow you to confidently continue with this Blog Series.

The Push Notification

To start things off, let’s talk about the Apple Push Notification itself and how it works. The primary purpose of a Push Notification is to alert a user about something related to your Mobile App, when your Mobile App is not currently active and in the foreground on his/her device. These notifications could include:

  • Informing a user that a new message is awaiting them in your Mobile App
  • Informing a user that they’ve received a new request they need to action via your Mobile App
  • Scheduling a reminder for the user
  • And the list goes on…

So, there are 2 types of Notifications:

  • Local Notifications
  • Remote Notifications (Also generally known as Push Notifications)

A Local Notification appears the same as a Push Notification, but the difference is that a Local Notification is created by your Mobile App on the Mobile Device it’s running on. An example of this is setting a reminder for the User. Your mobile app could set a Local Notification to run immediately or at a certain date and time.

A Remote Notification (Push Notification) is sent from a Cloud Server (e.g. IBM Bluemix) to Apple’s Push Notification Service, which in turn delivers it to your device. An example of this is when a message needs to be sent to the user from another device that has your Mobile App installed.

Push Notifications can appear as an alert, a badge or a banner and can play a sound when it appears on the user’s device. While a Push Notification contains standard values relevant to what’s required for it to appear on the user’s device, it can also contain custom data relevant to your Mobile App that can be used by your Mobile App to trigger certain actions.

When a Push Notification is triggered by the User of the device (e.g. swiping the notification), an action is sent to launch your Mobile App on that device. Your Mobile App can then get a handle on the Push Notification that was triggered by the user. This in turn allows your Mobile App to perform the necessary actions based on the custom data received via the Push Notification.

The Apple Push Notification Service and the Provider

The APNS, in short, is responsible for delivering a Push Notification do your device. Here’s where the tricky part comes in though. Let’s create a quick scenario:

You have a Web Application that manages leave requests. When you submit a leave request to your manager for approval, you want he/she to receive a Push Notification on their mobile device. Many would think it’s as easy as sending the request directly from your Website to the APNS, but it’s not. There’s a middle layer between your Web Application and the APNS, and that layer is called “The Provider”.

The Provider (e.g. Bluemix, Appcelerator, AWS, etc) manages the Push Notification Requests from your Web or Mobile Application. The Provider then communicates with the APNS over a binary interface. I will not attempt to bore you with the technical details of how the Provider communicates with the APNS, but if you want you can read about it here.

What matters here is that you understand the flow of a Push Notification from your application, through to the targeted mobile device. The below image (From Apple) explains this flow once your Push Notification Request is sent to the Provider:


The Mobile Application

In case you’re still wondering, a Push Notification’s existence is dependent on a Mobile App running on a user’s mobile device. You cannot send a Push Notification to a mobile device if there’s no mobile app to receive that Push Notification.

When your Mobile App is installed and launched on a user’s device, the Mobile App, if configured to receive Push Notifications, will register with the Apple Push Notification Service. Once registered, the APNS will send a device token back to the mobile device, who in turn delivers the device token to your Mobile App. Your Mobile App needs to then deliver the device token to the Provider (Bluemix), who also registers the user’s device.

Once this process is complete, your Mobile App is ready to receive Push Notifications via the device it’s installed on. What’s great about Bluemix as a Provider, is that they provide the necessary SDKs for iOS which allows the mobile device to be automatically registered on the Bluemix Cloud if registration with the APNS was successful.

What you as an iOS Developer should know

The key to getting all of this going is to understand Apple’s certificate requirements. Your Mobile App needs to have the necessary profiles and certificates installed in order to register for Push Notifications. Setting up the certificates is the trickiest part of this entire Blog Series.

My next blog post will focus on setting up these Provisioning Profiles and Certificates. Once we’ve got that monster out the way it’s all smooth sailing.

Cheers for now
11 Aug 2014

Bluemix iOS Push Notifications Tutorial: Part 2 – Minimum Requirements

In this post, I’m going to quickly highlight a few requirements before we officially get going with the Bluemix iOS Push Notification Tutorial Series.

1. Mac OSX and Xcode

For those out there new to iOS Development, you cannot test and deploy iOS Applications to devices unless you do it via an Apple Operating System. While you can follow this tutorial using Mountain Lion (OSX 10.8), I’ll be using and recommend Mavericks (OSX 10.9).

Then, you will need to download Xcode. Xcode is Apple’s IDE for developing Mac and iOS Applications. The latest release of Xcode is 5, which is required for this Tutorial as we’ll be deploying an iOS7 Mobile App to test Push Notifications.

Both Mavericks and Xcode 5 are free to download and are available via the Mac App Store. Simply launch the App Store App from your Apple Operating System and search for “mavericks” and “xcode“. You will need an Apple ID to connect to the App Store.

Screen Shot 2014-08-11 at 5.52.58 PMScreen Shot 2014-08-11 at 5.53.13 PM

2. Apple Device and iOS

Unfortunately, you cannot test Push Notifications on an iOS Simulator, which would’ve been awesome. So, you’ll need an Apple Device like an iPhone, iPad or iPod Touch. I would recommend anything from an iPad 2 and up, or an iPhone 4 and up. This will allow us to deploy our app as an iOS7 Application.

So, as mentioned above, your Apple device will need to run iOS7. iOS7 is free from the App Store and definitely worth the upgrade if you haven’t done so yet. The reason I stress using iOS7 is because I haven’t had the opportunity to test the Bluemix SDKs on iOS6. I also don’t plan to as iOS8 is already around the corner.

3. Apple Developer Account

Screen Shot 2014-08-11 at 6.13.18 PM

This is sadly where some money comes in. You’ll need an Apple iOS Developer License, which goes for $99/year. Setting up the license is fairly straightforward, but could take a few days to be activated depending.

If you don’t have an Apple Developer Account as yet, but want one to follow with this tutorial series, I suggest you get it registered sooner rather than later. If we were only developing to test on an iOS Simulator, this wouldn’t be required, but because we need to test on an actual Apple Device, this is compulsory. You can either use your existing Apple ID or create a new one for the iOS Developer Account. It doesn’t matter really.

4. IBM Bluemix Account


We’re almost done. What we’re going to need next is an IBM Bluemix account. This is free and is quick to set up. If you already have an existing IBM Id, then great for you. You can log into Bluemix with that ID and you’re good to go. Alternatively, click here to sign up.


With everything above set up and configured, we are ready to start developing iOS Applications, deploy them to Apple Devices and integrating them with the Bluemix Cloud.

The most difficult of all of this is setting up the iOS Developer Program. I did mine years ago and back then it required some documentation, phonecalls, etc. I’m not sure if it’s that complicated still.

In the next tutorial, I’ll be moving to video Media. I’ll be showing you step by step how to set up the necessary Apple Certificates which we’ll need for deploying to an Apple device and sending Push Notifications.

If you find yourself getting stuck with any of the above-mentioned, leave a comment and I’ll try to assist you.

Till next time :)
3 Aug 2014

IBM Bluemix iOS Push Notifications Tutorial: Part 1 – Overview


This is a short video series that I’m planning for the very near future, on how to get the Bluemix Quickstart Push Sample Project running on your Apple devices.

Purpose of this Tutorial

While the Bluemix team do well to make these sample projects as easy to implement as possible and provide the supporting documentation and instructions, this process is quite daunting from my experience. My goal is to take you through the entire process from having very little already set up, to running the Sample Project and sending Push Notifications to your devices from the Bluemix Cloud.

Overview of Tutorial Series

The first phase of this Series will focus on iOS and will be mostly made up of short videos. Once i’ve properly tested the Sample Project for Android I will initiate the next phase.

This Series will be broken down into the following Chapters/Blog Posts:

  1. Minimum requirements for iOS Push Notification Sample Project
  2. Set up Push Notification Certificate and Provisioning Profile on Apple Dev Center (Video Tutorial)
  3. Set up and configure you IBM Bluemix Mobile Cloud Project (Video Tutorial)
  4. Set up and configure Apple Push Notification Certificate for your Mobile Cloud Project (Video Tutorial)
  5. Download and install Bluemix Quickstart Push Sample Project for iOS (Video Tutorial)
  6. Deploy and test Quickstart Push Sample Project as an iOS App on your device (Video Tutorial)

I’ll get the Chapter on minimum requirements out in the next few days and will take it from there.

Cheers for now.
12 Jun 2014

TIP: Create global batch files for use in Terminal

I’m slowly but surely becoming a huge fan of running my development workflows through Terminal on my Mac, especially in the case of mobile development using Appcelerator Titanium. This is a quick tip to show you how to group terminal commands into batch files and have these batch files accessible anywhere when working in Terminal.


  • I haven’t moved to Mavericks as yet, so my example below applies to Mountain Lion, but should also apply to Mavericks
  • In my example below, my batch file navigates to the required folder, builds and runs my mobile app the iPad Simulator
  • To enable/disable hidden folders and files in Finder, I recommend using Funter or Mountain Tweaks
  • You can’t double click on a hidden file to open it, you need to right-click on the file and select “Open”

Do The Following

  • Open TextEdit and add your commands to it, each command on a new line (See below what I did)


  • Save this file and provide a file name without a suffix/file extension (i.e. file name = debugapp) and put it in a folder of your choosing. (e.g. “Users/{username}/Documents/terminalcommands“)
  • Under the “Users/{username}” folder, search for a hidden file called “.bash_profile” and open it
  • NOTE: if you can view hidden files in Finder and you don’t see the “.bash_profile” file, you will need to create it using TextEdit or something similar
  • Next, to add your folder path to the PATH Environment Variable, on a new line, type in export PATH=/Users/{username}/Documents/terminalcommands:$PATH


  • Save and Close
  • Restart Terminal

Test if this worked

  • You can check the $PATH variable by entering echo $PATH in Terminal
  • To run your batch file, simply enter the batch file name (e.g. debugapp) in Terminal
I hope this works for you :)