If you like my tutorials, you will love my book . It is chockful of advanced programming techniques and the only comprehensive barcode reference for serious iOS developers.
Our DNA is written in Objective-C


I’ve been watching the WWDC Keynote presentation together with a couple of friends and one other iPhone developer and here’s the general consenus: We are disappointed. But are we righteously so?

Most of the otherwise exciting news was leaked to the public in the weeks preceding the event which unfortunately caused expectations to be way too high. Apple can do magic, but some things just take time. Like a fully recovered Steve Jobs or even a 10″ Mac Tablet we have been lusting for.

These where the biggest surprises that where met with a certain degree of enthusiasm:

MacBook Line Refresh

  • All Unibody MacBooks are now called “Pro”, dropped in price and get better CPUs
  • SD-Card Slot is now standard
  • The return of the Firewire port
  • The new “7 hour battery” technology not found in all Macs

Safari 4

I’ve been using Safari 4 for a while now but I had a problem where I would not be able to insert links into articles on my WordPress dashboard. But since I updated to the release version of Safari 4 I am happy to report that this problem is gone.

Safari is the fastest and most standard-compliant browser currently available. There is a strict benchmark called the Acid 3 which gives Safari 4 a whopping 100 out of 100 points. Safari 3 scored 76 and the new Internet Explorer 8 even less.

Also the performance of Safari when it comes to rendering and JavaScript is way ahead of the competition. Ah, and btw there are 150 new features. I especially like the new coverflow search of your browsing history. A great method to quickly find a page you recently looked at by typing a few words.

Snow Leopard

The name similarity might be meant as a hint as to the similar 64-bit underpinnings of OSX between the current version Leopard and the soon to be released Snow Leopard. The general theme is to squeeze every additional drop of performance out of the hardware. In Leopard the built-in apps still where 32-bit, but now they are recompiled with 64-bit causing a slightly better performance.

So there is special support with a new technology built into the core named “Grand Central Dispatch” which cares to more efficiently distribute loads between multiple cores. And with OpenCL it is possible for the first time to also use the graphic processing unit (GPU) to offload specific processing tasks.

Quicktime X is the newest version of Quicktime, the video playing and recording infrastructure in OSX. Again, the focus is on additional performance. Many people got annoyed that they needed to pay extra for Quicktime Pro, but this is now a thing of the past.

What I list most, personally, is that now Exchange-compatibility is complete. In Leopard you need Entourage to access your Exchange calendar and contacts. With Snow Leopard no longer. This is great news for people like me who has the family on Exchange as well as people would take their Mac to work because now they can work as an equal without having to install Microsoft Office.

There are also a couple of additional new things related to Exposé and Stacks.

But the greatest thing is Apple’s impeccable timing and pricing. Existing Leopard users get the update for just $29 in September, one month before Windows 7 is being released. The family license will cost an enormous $49.

iPhone 3GS

A great video tour on the iPhone is available on the Apple website.

  • Faster
  • Better Battery
  • Better 3 Megapixel Camera with Auto-Focus, or tap-to-focus for close-ups
  • Video Recording, Editing, Sending (MMS, E-Mail or direct to YouTube)
  • Voice Control (Press-and-hold Home) for dialling or controlling music playback with voice synthesis feedback
  • Magnetic Compass, Google Map now orients in correct direction you are facing
  • Digital Compass

OS3-specific (i.e. for all iPhones)

  • Copy&Paste
  • Voice Memos
  • MMS (finally, but who needs it?)


So in summary we CAN be happy with Apple, we’ll got a free new Safari and will get the new iPhone OS in the next two weeks. It’s again a good time to buy a new Mac right now because for $29 it does not pay to wait to get Snow Leopard with a new machine. And the new iPhone 3GS is just compelling enough to nudge speed and feature freaks to shell out.

On the minus side there are a couple of things that still take some time. I am phrasing it like that because we still want to see: Steve Jobs’ return, a Mac Tablet or Mac Netbook and maybe something really mindblowing.

Right now Apple does what every smart dealer of drugs for the technophile is doing: Give a little more every time there is a Keynote presentation. Up the dosage without overloading the audience. And on this strategy they have delivered once again.

Wait a Week

Moshe asks:

“How can make my app show a message 1 week after an event? I want to show an alert view the first time the app is launched after at least 1 week has expired and the event is still true.”

This technique can be used for any kind of action you don’t want to do right away or somehow should be based on a value determined in a previous run of your app.
Read more

Sending E-Mail Attachments

Ravikumar Gajjavelly asks:

I want to send email It contains image as an attachment.How can we send am to attach image.can anybody please give solution.

When creating my app GeoCorder I was faced with the exact same dilemma of needing to attach a file to an email. I did some research and this is what I found.

Read more


While I was concentrating on being newly wed, Michael Dorn launched his app ranking service into an open BETA phase. Because he is no putting all his development efforts into this site he has deprecated AppRanking for FREE which has been available for download from the Dr. Touch blog.

Applyzer is now looking for about 100 people to help test the new server and database. Participation will be for free during the BETA phase, after this time free apps’ data will stay free, paid apps data be available for a small monthly fee.

The BETA phase is scheduled to run until June 30th.

Read more


Mr. and Mrs. Touch are away on a short honeymoon in Bad Blumau Thermal Spa.

Thank You for all your happy wishes and congratulations. I believe that most of them belong to my wife Britta for becoming more important to me than all my Apple devices. (At least long enough to say my vows)

I’ll see you all when I get back to Cocoa surgery, training and frantic coding now with always-on Wedding ring.

Advanced Sorting of NSArray with Functions

I’ve already discussed previously how to sort NSArray with descriptors and selectors. Even how to unsort it i.e. shuffle it. You can use descriptors to sort by KVC-compliant properties. Selectors you would use if the objects contained in the array have a comparison method themselves.

For those special cases where you neither have properties nor a suitable sort method built into the objects to be sorted you have to resort to the third and last method of sorting an NSArray: with a specialized sort function.

For two projects I need to sort an array of NSDictionaries. Here I’ll show you how I did it.

Read more

State of the Art in App Cracking

ARTeam ReportARTeam, a group of hackers who – according to their homepage – specialize in reverse engineering released a 29 page report titled “Patching Applications from Apple AppStore with additional protection” that shows the state of the art on iPhone app cracking.

This report was released in partial secrecy on May 16th on the ARTeam download page. No blog article. No announcement. It was only stumbled upon by a German blogger who on condition on anonymity provided it to me after I asked nicely. The report even has a section about “licensing”.

All code included with this tutorial is free to use and modify; we only ask that you mention where you found it.

Ok, I told you where I got it. Now let’s see what goodies it unearths.

Read more

Target-specific Headers

Often you will add multiple targets to your project file to build variants of the same app. For example if you have a Lite version or Ad-sponsored variant using the same source code you would definitely save yourself a lot of work having a single project and then multiple targets.

While I was helping a colleague merging three projects into one we found it impossible to assign headers to single targets. You can assign source code, images and lots of other file types, but why oh why no headers? How would we make sure that from 3 Constants.h files always the correct one would be used?

There are of course methods out there which propose to either have a script replace the headers or use an ugly contruct like this:

#if defined(TARGET_1)
#elif defined(TARGET_2)
#error Must define a TARGET macro!

I you you too are cringing from seeing such code. Surely there must be a more elegant solution. I searched, and I found not one but TWO.
Read more

Custom Back Button on Navigation View

When you push a view controller onto a navigation stack, the back button will always show the title of the previous view controller. This can lead to ugly effects if the title is too long. But then again, you want long titles on your view controllers because you don’t want to let the title bar space go to waste.

The method of how you can customize the back button is a little bit counterintuitive, but it was shown on episode 13 of the Standford lectures. [Here my I came to a screetching halt]

When I went to search my Blog for the link to the Standford stuff, I also found that I had already posted exactly the same recipe already one month ago. And  It’s still valid, even though I did not remember posting it. This serves to show that you might not be as productive at 5 am in the morning as you would assume. Memory is lacking then.

Well, just to put in at least something new, here is a before and after visual illustration:





Go to the previous article “Shorter Back Buttons

GeoCorder 1.0.3

The customer crash reports that Apple now makes available showed me a problem with GeoCorder that I had missed.

  • Removed redundant code that would load and save tracks in a seperate file in addition to the trackpoints written directly to a SQLite database while recording. This could cause timouts on program exit and long loading times at program start for people with lots of recorded trackpoints.
  • Thus program start and exit are now much faster for people with lots of recorded tracks.

It’s embarrassing I know, but how can you spot such a thing? When you test your app you don’t think to record so many tracks that applicationWillTerminate will time out and be aborted by the iPhone OS. But thanks to the crash reports I was immediately steered in the right direction of what to fix.

I’ve submitted this quick fix release to Apple, more usability enhancements are in the works.

UPDATE May 16th:

Apple rejected the update claiming that without network connectivity the screen stays black. That’s not possible because GeoCorder has a Default.png image and there is no network activity unless the user sends a track via e-mail. I tested the app on my iPhone 3G on 2.2.1 and iTouch 3.0b5, with and without network. No black screen.

But to be safe I ran Clang Static Analyzer over the code for 2.0 and even 3.0 and found a couple of unused variables, a mismatch between unsigned and signed and one code file that was not even used. So I cleaned those up and resubmitted.

UPDATE May 21st:

Apple rejected it again this time with an even more annoying message. But this time is the first time that they actually provide some information how I can fix it.

Your application, GeoCorder, cannot be posted to the App Store at this time because it does not adhere to the iPhone Human Interface Guidelines as outlined in iPhone SDK Agreement section 3.3.5.

When the device is not connected to a network, GeoCorder does not load its contents. When the user is on the “Record GPS Tack” screen the App fails to load location (please refer to screen shot). This behavior might lead to user confusion. It would be appropriate to display either a notification or an alert stating that internet connectivity is required.

Please take a look at the Reachability iPhone program sample which demonstrates the use of the System Configuration Reachability API to detect the absence of WiFi and Wireless Wide Area Network (WWAN) services. Your application can then take appropriate action at the first point where network services are required.

Translation from convoluted to plain English: In Airplane Mode the iPhone does not get Core Location updates. Now why do they think of this NOW on the THIRD version I submitted to them for review?!


I finished the app (once again) and submitted it to Apple with these enhancements:

  • I revamped the inner workings of the blip graph so that it can show recieving of Core Location updates independently from whether the user chooses to record them or not. Non-recorded blips are grey, recorded ones are red.
  • Position updates are now active as soon as the recording modal screen is opened and are deactivated as soon as the screen is exited.
  • Implemented connectivity sensing according to Apple’s suggestion. If you enter the recording screen without internet connectivity you get an alert to that effect.
  • I made a nicer splash screen, because having it look like the final recording table view would anger users because it would look like for the time of loading that the app does not react to user input.
  • Also I submitted a new free version of GeoCorder which will be sponsored by AdMob. It’s technologically identical to original GeoCorder.

I’ll update as soon as they get through.

UPDATE May 24th:

I received a crashing bug rejection (for a change *G*) for GeoCorder [FREE].

Thanks to the attached crash report and detailed instructions on how to reproduce the crash I quickly found the problem and fixed it. I had a dangling object reference to previously released memory. This would show if you recorded a track, removed it and tried to record another. Since both GeoCorders share the same code I had to replace the binary for regular GeoCorder as well.

Apple is getting faster, at least with newly submitted apps. I’m glad Apple Reviewers are working on Saturdays as well to work through new apps. That can only mean that they have multiple shifts, because Saturday is not a regular work day in the USA.

UPDATE June 16th

Apple had approved the free version rather quickly but the regular version was stuck “in review” even though it contains exactle the same code and functionality minus the ads. I wrote to Apple two days again and now finally the regular version became available as well.