How many lines of code do you have to write for displaying a webpage ‘in-app”. 3 methinks. Wouldn’t be great if there is a built in class for presenting a webpage using “presentModalViewController”? Meet MKWebViewController. Step 1: Drop the attached three files into your project and write the following three lines on your action callback (buttonDidTap) or equivalent methods MKWebViewController *controller...
Read MoreiPhone Tutorial: Better way to check capabilities of iOS devices
The iPhone OS started off with a single device, the original iPhone, ala, iPhone 1,1. In the last three years, Apple has been innovating hard and introduced multiple devices running the same operating system with different capabilities. For example, the original iPod touch, iPod 1,1 wasn’t able to record audio input, and till date iPod Touch cannot vibrate as a result of an alert. There are many such subtle differences between...
Read MoreiPhone Tutorial: Scheduling Local Notifications using a Singleton class
In iOS 4, Apple introduced a new way to send “push notifications” to your app without having a dedicated server and associated server side coding. The technique is called as scheduling local notifications. While this tutorial is about how to schedule local notifications, I would also explain how a powerful abstraction concept, Singleton design pattern could make this easier when adding local notification support to your app. If...
Read MoreXCode Tip: Objective-C Singleton Class Template
I have a habit of creating Singleton pattern classes for nearly every application I write. I manage the Settings Bundle (or any app settings, thru a Singleton class), my MKStoreManager for doing in-app purchases is a Singleton class. Even in Apple’s own code you can see some Singletons like UIApplication, Reachability (from the Reachability example), UIDevice and such. You normally access them through an exposed instance of the class....
Read MoreiOS4 Issue: NSURLConnection and NSOperation
Everyone knows NSOperation is easily the best way to automatically gain powerful multi-threading on iOS/Mac platforms. However, recently for one of my apps, I faced a issue where, the NSURLConnection’s initWithRequest method doesn’t automatically start even if you forcefully send the “start” message. For example the below code works perfectly on iPhone OS 3.1 and below but fails on iOS 4. - (void)start { [self...
Read MoreiPhone Tutorial: How to send In-App SMS
Officially, iPhone OS 4 is out of NDA and I can’t write a post on this. If you have been reading my blogs, you might already know how to send a in-app email Sending a in-app SMS is very similar to this, but with subtle differences. Prior to iPhone OS 4, developers have to depend on [[UIApplication sharedApplication] openURL: @"sms:12345678"]; The problem with this is not just that it closes your app, but...
Read More