Posts

Showing posts from May, 2015

Building my first mobile app: the journey so far - Part 1: The background

So I have made references to my iOS app in a lot of my previous posts, if you refer to my post on Why can't I cancel a local notification in my iOS app? (in Swift) , it mentions some of the posts that I have written on how I have solved some of the problems that I have come across. It's been a year since I have been working on the app and now that I am close to finishing it, I thought I would write a little bit about the background of how this app came to be. Prelude: the land of blue skies and sunshine The year was 2013 and these were some of the key aspects of my life, I was a bit of a fast talker and people often told me, my English ascent was pretty flat for a man from India I kept fit and I did regular runs with each run being over 8-10 km I had a very loving girlfriend and we had plans to get engaged to be married in 2014 I had a job that I loved and enjoyed After years of living in a place sharing with flatmates and all, I was finally living in my own apart...

Getting the user's permission to send them local notifications in iOS (using Swift)

Ok for iOS devices I think it will still be at least another year, till we have devices that are using versions earlier than iOS 8 ! so what does that mean? Problem Well, it means that if we are building an iOS app that works on both iOS 7 and 8 which uses a feature introduced in iOS 8, we need to check if that feature exists on the device before using it. Now the iOS app that I am building uses local notifications and in iOS 8 Apple introduced this feature to ask the user to receive LOCAL NOTIFICATIONS via   registerUserNotificationSettings . So what I wanted to do is check if the feature exists on the device the app is running on without checking the iOS version on the device via  UIDevice.currentDevice().systemVersion . Solution So turns out NSObject has this really useful method called instancesRespondToSelector , so I can solve my problem of finding out the presence of registerUserNotificationsSettings using the following code, UIApplication.instancesRespon...

The importance of unit tests and how I realised it?

So my first iOS  app is nearly complete; by nearly complete, I mean it is a working app that I am using on a daily basis. I plan to use it for another two weeks or so, and see if can break any app feature in my daily usage. This is also a time when I have added every major feature to the app and what I do from time and again these days is a minor UI fix or optimise some of my earlier iOS code. You see, I started working on this app over a year ago and in that time, my knowledge of iOS programming has grown, I know more now, and I often find myself realising that there is certain code in my app that could be better written. So I go ahead with the re-write if it is nothing too major. One potential risk/side-effect of a minor UI fix or code optimisation is that I often end up breaking other app features. What have I learned? Well at this point I realise that had I written a bunch of unit tests in the beginning, testing the app after every minor fix or optimisation would have bee...

Why can't I cancel a local notification in my iOS app?(in Swift)

Prelude I have mentioned the fact that I am working on my first iOS app in a number of my previous posts and as such I face a number of newbie/noob(?) problems. They are not really problems as much as they are simply things that I do not know, for e.g. the following, how do I get the day of the week? where is my string.replaceAll in Swift? knowing which local notification brought my app to foreground ? serving HTML content in an iOS app that works on iOS 7 and above Thankfully, I have managed to make at least one generic solution and contribute it to the community i.e. my open-source Xcode project template( HTML5StarterAppWithSwift ) which you can get from Github . So this post basically describes another very simple problem that I have found a solution to, but I do not fully understand why the problem was occurring in the first place. Introduction As I have mentioned in this post , my iOS app uses local notifications i.e. UILocalNotification   and i...