Johnno's Workbench - Tips, Tutorials, Domino, XPages, Java, Mobile, Appcelerator, etc

9 Oct 2014
0

Webstorm Tip: Use Key Promoter to help you find Keyboard shortcuts

For me, there are too many keyboard shortcuts to memorise in Webstorm IDE? Thanks to a nifty plugin, these shortcuts can be learnt on the fly.

Overview

What Key Promoter does is monitor your mouse clicks on Menus and Toolbars inside Webstorm. If a shortcut exists for where you mouse-clicked, Key Promoter will show you the Keyboard Shortcut command that you can use for that same action.

Firstly, where to find references to Keyboard Shortcuts

Note: The below instructions are for Mac, but Windows will be very similar.

  • Top Menu > Help > Default Keymap Reference
  • Top Menu > Preferences > Keymap
  • Keyboard: CMD + SHIFT + A (For Mac)
  • Keyboartd: CTRL + SHIFT + A (For Windows)

To install Key Promoter

Note: The below instructions are for Mac, but Windows will be very similar.

  • Go to the Webstorm Preferences: Top Menu > Preferences
  • Search for “Plugins”
  • Click on “Browse Repositories”
  • Search for “Key Promoter”
  • Click on Install Plugin
  • Restart Webstorm

Webstorm

Test Key Promoter

After restarting Webstorm, you can test Key Promoter by performing the following mouse actions below:

  • Clicking on the Changes Tab at the bottom of the Webstorm IDE

Webstorm2

  • Clicking on the Git Update Project icon on the top right of the Webstorm IDE

Webstorm3

Closing

I trust this tip will help you be more productive when developing? Stay tuned for more.

Cheers for now
John
3 Oct 2014
6

Appcelerator fix for Ti.Map on iOS after upgrading to Titanium 3.4.0

This is a quick tip on how to get Ti.Map working again on your iOS7 builds after upgrading Titanium to SDK 3.4.0.

Quick Note

For the sake of those who just want to know how to fix the problem and not why it occurred, I will commence this post with the fix and then after that explain what I assumed happened.

Also, thanks to Tim Poulsen and Boydlee, please see below Option 1 on how to resolve this issue best. I’ve kept my option as Option 2

How to fix the issue – Option 1 (Thanks to Tim and Boydlee)

  • In Titanium Studio, open the tiapp.xml file in your mobile project
  • Under the Modules section, double click on the entry “ti.map”
  • Change the version to 2.0.2 (Which seems to be the version that will work with SDK 3.2.0 and up)

TiMap5

How to fix the issue – Option 2

  • In Finder, navigate to “Library > Application Support > Titanium > modules > iphone > ti.map
  • Starting with the latest version of Ti.Map, open the relevant folder (e.g. 2.0.5)

TiMap

  • Open the manifest file using TextEdit
  • Check the mindsdk property. If it says 3.4.0, then it will only work for iOS 8 Builds

TiMap2

  • If you want to still develop for iOS7 and use Ti.Map globally for all your apps, then you will need to delete the version of Ti.Map relevant to the above-mentioned
  • In my case, I needed to delete the 2.0.4 and 2.0.5 folders. Now, my latest version of Ti.Map is 2.0.2

The error I was getting

I mentioned in a previous post of mine, that the reason I upgraded Titanium Studio to version 3.4.0, was because Xcode 6 silently installed itself on my machine. When I upgraded Titanium to 3.4.0, I got the following error message when trying to run a build for an iOS7 app that makes use of the Ti.MAP module:

TiMap3

 

My assumption of what happened

So, here’s a shot in the dark of what happened. When upgrading to Titanium Studio 3.4.0, Appcelerator saw that I had the Ti.Map module (which Appcelerator developed) and immediately downloaded the latest version (2.0.4 or 2.0.5), which I assume is required for iOS 8 development.

The truth is, I can’t remember what version of Ti.Map I installed last, but I do know that it was working. When I opened the modules folder on my Mac, the latest version was 2.0.4.

At this time I thought that maybe I downloaded 2.0.4 a while ago, and during the update of Titanium Studio this module was modified accidentally by the update.

My first attempt to fix the problem

First thing I did was check on Github what the latest version of Ti.Map was. I noticed 2.0.5 was released and downloaded that to my modules folder.

Sadly this did not fix the problem. I still received the same error as before.

My second attempt to fix the problem

I got a bit clever and opened the manifest file for version 2.0.5. I noticed that the minsdk parameter had a value of 3.4.0. I changed this to 3.2.3.

The good news is that my app was successfully running again. The bad news is that when launching any window that made use of the Ti.Map module I got the following error:

TiMap4

It was here that I finally made the assumption that Ti.Map 2.0.4 was automatically downloaded, as it contains code that only works in XCode 6.

My third attempt which finally fix the problem

What I did next was started from the latest version of Ti.Map, and checking backwards which version had a minsdk lower or equal to 3.2.3. In my case, it was version 2.0.2 of Ti.Map. So I deleted the 2.0.4 and 2.0.5 folders, reran my iOS7 build and Boom. Everything is working again.

I hope this helps everyone. I welcome any input that would assist in understanding what happened here.

Cheers for now
John
1 Oct 2014
11

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 “XCode.app” icon on to the “Applications” icon.
  • When prompted if you want to “Replace” or “Keep Both” files, choose “Keep Both“.

Apple1

 

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

Apple2

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

To achieve this, do the following:

  • Open Terminal
  • Type in “sudo xcode-select -switch /Applications/Xcode511.app/Contents/Developer”
  • 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.

Apple3

 

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

Till next time
John
17 Sep 2014
0

Calling on iOS, Android and Appcelerator mobile developers in Gauteng, South Africa

Are you a native iOS or Android Developer? If not, have you developed mobile apps for iOS and Android using Appcelerator or something similar? We’re hiring!

Our mobile division is expanding at an exciting rate. We are looking to all mobile developers who meet the above pre-requisites and who are interested in joining our team.

We are based in Centurion, Pretoria in Gauteng, South Africa. We’re primarily interested in permanent positions, where temporary/contract positions would only be entertained based on certain conditions.

If you are interested, please send your CV and a small example of your work to (john dot jardin at gmail dot com).

If you have any questions, feel free to comment on this Blog Post or interact with me via Twitter, LinkedIn or Google+.

Looking forward to hearing from you :)

Cheers
John
2 Sep 2014
0

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).

Overview

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:

APNS

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
John