Latest Articles

Use the navigation at the bottom to see older articles

How to create a single In-App Purchase in iOS 7

This “simple everyday” feature has caused me many headaches on many occasions. Implementing a simple unlockable feature isn’t as straightforward as it perhaps could be – and I’ll make it as simple as possible (so I won’t forget next time I need to add it to an app). In this example we’re going to have […]

How to open the LinkedIn App from your own iOS App

Here’s a sample action that tries to open a LinkedIn Profile with the LinkedIn App. If it’s not installed, it opens a link to the profile in Safari. If that doesn’t work it gives a log message (please handle appropriately in your own code): – (IBAction)openLinkedIn:(id)sender { // open the LinkedIn App if (![[UIApplication sharedApplication] […]

How to create a Twitter Follow button in your iOS App

Much like the Facebook Like button we can create a Twitter Follow button. It’s easy to create a HTML button which we can load into a small UIWebView (about 40 pixels high): – (void)viewDidLoad { [super viewDidLoad]; // add Twitter Follow button in a web view NSString *twitterFollowButton = @”<a href=’https://twitter.com/versluis’ class=’twitter-follow-button’ data-show-count=’true’ data-size=’large’>Follow @versluis</a><script>!function(d,s,id){var […]

How to open the Twitter App from your own iOS App

Opening the Twitter App is pretty much the same as opening the Facebook App discussed earlier, just the URL scheme is different. This is how we open Twitter so people can follow the user (me in this case, versluis). If the call is unsuccessful, we’ll try to open the Twitter page in Safari. And if […]

How to open the Facebook App from your own iOS App

Thanks to Custom URL Schemes, iOS Apps can register themselves and be “woken up” by another app (such as yours). Many can even accept parameters if you do. Opening another app happens via the UIApplication class, and an NSURL as parameter. Here’s how we open the Facebook App and direct it to open my Pinkstone […]

How to create a Facebook Like button in your iOS App

Adding a Facebook Like button to a website in HTML is extremely easy, thanks to Facebook’s Developer API. But it’s not as straightforward to implement it in an iOS App. Thanks to UIWebViews we can create a small web view, perhaps 80 pixels tall, and load the Facebook Like button into it. Here’s how: – […]

How to store a BOOL as NSNumber

You can create an NSNumber with a BOOL like this: BOOL myBool = YES; NSNumber *boolNumber = [NSNumber numberWithBool:myBool]; NSLog(@”boolNumber is %@”, boolNumber); // gives 1 for YES and 0 for NO It is technically the equivalent of creating an NSNumber with a literal @1 or @0. To turn the NSNumber back into a BOOL […]