Archive for the ‘iPhone’ Category

My first iPhone / iPad apps

August 25, 2010

Here’s a long overdue post. Below you will find links to two iPhone / iPad applications developed by yours truly.

As you can probably guess I am hoping to add more books in the series when i find the time.

Sales hasn’t exactly shot through the roof, with on average one to two copies a day.


iPhone SDK: Show address in Google Maps

February 17, 2009

As a part of the project i am currently working on (seems there is a difference between finished and FINISHED), i had to implement the pretty standard feature of displaying an address in Google Maps. To my suprise it took me quite some time to find the code, so to make things easier for others, i thought i would post it here.

If found a demo app ( that shows how to use multiple different url types (phone, email, etc.). At a glance it worked fine, but when i tried to open a Danish address with special characters (æ, ø, å), the “address” bar in Maps would just read “null”. It turned out that who ever put together the sample app, used NSASCIIStringEncoding as the format for encoding the spaces in the address – in my example i changed it to NSUTF8StringEncoding. Enjoy:

// Where is Apple in Denmark on the map anyway?
NSString* addressText = @"Nørre Voldgade 11, 1358 København K";
// URL encode the spaces
addressText = [addressText stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
// Combine url
NSString* urlText = [NSString stringWithFormat:@"", addressText];
// Open url
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];

Working with iPhone contacts: Adding phonenumbers to ABPerson

January 27, 2009

So.. after figuring out how to store a contact in the iPhone addressbook, using the AddressBook framework of the iPhone SDK, i realized that storing phonenumbers wasent quite as straight forward as storing fields like first- and lastname.

Phonenumbers are stored in a “multivalue” property. This means that multiple values with different “labels” can be stored for the property “phone”  (kABPersonPhoneProperty) of a person.

Anyways – i thought i would throw in the code:


Add entry to contacts using iPhone SDK

January 18, 2009

So i recently started programming for iPhone. As part of the project i’m currently working on, i have to add new entries to the phones address book (contacts). The address book api is not very intuitive, seems to be a straight C api and is poorly documented. It took me a lot of googling to find the solution, so i promissed my self i would post the code once i found it .