Our DNA is written in Objective-C

Backwards Compatibility if Apple Starts Polishing

You can see that Apple is constantly polishing the APIs from version to version, but sometimes they make a more drastic change that breaks existing code. Well, not exactly “breaks”, but starts to show warnings about you daring to use deprecated methods.

One such change came out of their trying to adhere to their own naming conventions of methods. The second kind of late polishing is if there are new structures introduced without a matching Make macro for easy filling of said structures. I have an example for you, also in CoreLocation.

In this post I’m exploring two such changes and tell you how I dealt with them in a backwards compatible way.
Read more

Apple Music Event, Everything iOS!

The question that we developers are always asking ourselves after such an Apple event: “what was in it for us?” There are the highlights relevant to us:

  • iOS 4.1 release is imminent, if not today then this week. GameCenter being released, update your games! Ah and you don’t need any HDR app any more, the iPhone shots 3 images at the same time and combines them. Groovy!
  • iOS 4.2 coming in November, for all devices being able to run 4.x, but the main focus is to bring all the 4.0 niceties to iPad: Multitasking, Folders, etc. And the best new feature for productivity apps: Wireless Printing!
  • There are 230,000 iOS devices being activated every day, NOT including updates. Steve kind of hinted that the number that Google mentioned is not really honest in that regard.
  • The new iPod Nano is square indeed and clearly runs iOS. For the time being Apple does not give us ability to code apps for the small screen, but that might be coming eventually.
  • New iPod Touch is now an iPhone 4 without the phone. Retina display, Gyroscope, A4 Chip. Even more reason to update your artwork and add a 2x version for all images. And since the iPod Touch now has two cameras any apps making use of AV capture devices has a way bigger audience
  • New Apple TV is now at a price point reachable for everybody. The previous Apple TV was running an old OSX version, this new version clearly is iOS based, also because it has an A4 chip. But just like the Nano, no third party apps (yet?). It does not have storage though, so where would you store apps?
  • One of the new things in iOS 4.2 will be AirPlay which allows HD videos to be streamed from you iDevices straight to your AppleTV. Do we see a wireless UIScreen that we can do the same from our apps in 4.2?
  • New social music service directly in iTunes 10. You see which music your friends like. How about adding the same for apps?

So half of the news is great for us, more iOS devices that we can develop for with new tech. And more iOS devices that we WILL be able to develop for. Everything points to Apple wanting to keep enough news to themselves to not over-excite us iOS developers.

BUT! (one more thing) I foresee another Apple event happening at the beginning of 2011 filling all the above mentioned holes.

Building the Ultimate iOS Source Store

When I quit my employment as Windows system administrator in December 2009 I had already been developing iOS stuff for 2 years. At that stage I had to define what my business should be comprised of and I decided on a multi-pronged approach. I simply lack the design capabilities and ideas to sustain myself on apps alone.

The Past

One of the multiple streams of income that a holistic iOS business can generate are sales of software components. Often there’s a functionality that you wished Apple would provide or made simpler to use but you lack time and expertise to write such a component. And you lack funds to hire a professional at a rate of several hundred dollars per day. What if you could share the development cost with dozens of other fellow developers? The pro would still get payed, but you trade exclusivity for availability.

This is what I created my Dr. Touch’s Parts Store for.

Often I get asked, how this is going for me. Here’s my first go at answering that: pretty well! I’ve been doing that for 7 months now, which provides a bit of data that we can slice and dice. Also I’ll tell you about the present state of affairs as well as present to you my vision of the future: The Ultimate iOS Source Store.

Read more

Dr. Touch #020 – “Summer Pause”

Between Apple event’s it’s back to looking for interesting rumors out of Cupertino. And my guest on this show is Ken Seto who made $100000 in 4 months with iMockups for iPad.


The Show Notes and script after the break.

Read more


If your app requires an internet connection for certain tasks you will have to be able to deal with situations where connectivity drops out for some time. For many cases it might be sufficient to display an error when stringWithContentsOfURL returns nil, but it’s better customer service to inform the user beforehand. Apple thinks so too, they test all apps also in airplane mode and your app better not crash or confuse the user or else it will get rejected.

Fortunately there is a great sample on the Apple Website that you might have heard it’s name mentioned in many circles: Reachability. The first version of this was difficult to use but Apple staff keeps polishing their works and so we have reached version 2.2 already, recently updated for iOS 4. The major change that 2.x gave us is the ability to get continuous updates on connection availability. This enables us to have our apps work similar to the iTunes app which displays a message to this effect when there’s no connection and has the UI return as soon as the connection is back.

So, let’s explore how to add the source for Reachability to our project and have some live checks.

Read more

iPhone 4 Tripod Mount Shootout

UPDATE: I also reviewed the glif and compared it with these mounts.

If you’re like me then you justified getting an iPhone 4 (on top of the original 2G, 3G and 3GS) by telling your wife “honey, this has an HD camcorder BUILT IN. By getting this we actually SAVE the money for an extra device.” And then on the second or third video you’re shooting you’ll find that you have the hands of a programmer and not of a surgeon. Meaning that it is next to impossible holding the iPhone perfectly steady.

Yet once more we see that technology has advanced to a level where it is no longer the limiting factor, but instead the human body is. For all intents and purposes of my iPhone business I deem the quality of the iPhone 4 video recorder more than sufficient. If only there was something that would help me steady my aim and frame. Well, there is, because this problem is one that photographers and videographers have been having for a long time. And most of the solutions revolve around contraptions that allow you to levitate your lens in a fixed distance from the floor.

I am of course talking about the tripod. You might remember from geometry that any surface can be described by 3 points. Tripods define a point by three feet. The point where you can mount a camera usually has two or three degrees of freedom which you an restrict by tightening screws. One or two of these screws might be attached to a handle that would allow you to move the tripod head around and adjust the tightness of one scree by turning your wrist.

I shopped around for a 3-way tripod to mount my iPhone 4 on and ended picking the Cullmann Nanomax 250 which is a sturdy but extremely lightweight tripod that almost fits into my backback. Because it is made out of aluminum it weighs only 2.3 lbs (1 kg). So it’s ideally light and compact to work for a blogging developer like myself. Cullmann in Germany grants you 10 year warranty on the tripod if you register on their website.

But this article is not about my choice of tripod. Once you got one you are presented with the challenge to somehow mount your pretty iPhone on it. That’s where special cam mounts are necessary. I asked around on Twitter and two options were recommended to me. I purchased both and now I’m going to compare them so that you don’t have to.

Read more

NavigationController from NIB produces sticky gray empty status bar on rotation

I’ve decided that I’ll share my bug reports on my blog from now on as well. Usually you’ll have to make a small demo project to demonstrate the bug to Apple’s engineers and then they are the only ones to see my work. What a waste.

I still believe that Apple’s Bug Reporting system should be open for everybody, but since Apple is still run like a small startup they feel that it helps them conserve more resources to have it closed. That’s why there is Open Radar which somebody put on Google App Engine.

So, here’s my full bug report plus the demo project and screen shot. See if you can reproduce it and find a workaround.

NavigationController from NIB produces sticky gray empty status bar on rotation

16-Aug-2010 06:40 PM Oliver Drobnik KG:

If you load a navigation controller from MainWindow.xib, but add the first view controller in appDidFinishLaunching, then there is a problem on rotation. A gray empty status bar appears underneath the regular status bar which cannot be eliminated.

Steps to Reproduce:

  • Create a Navigation based project.
  • Set status bar to be initially hidden.
  • Set navigation controller to want full screen and have nav bar hidden
  • Implement a tap method in the view controller to hide and show the status bar
  • Move the view controller outside of the navigation controller in the IB
  • Add a line to app delegate to push the now separate view controller onto the navigation controller.
  • Start the app, rotate once sideways with shown status bar
  • tap to hide the status bar

Expected Results:

No extra gray status bar.

Actual Results:

A sticky gray status bar appears underneath the disappearing regular status bar.

I’m attaching a project to demonstrate the behavior. Plus a screenshot.

The behavior is inconsistent with creating a navigation controller in code. There no extra status bar appears.


I filed this bug report on Open Radar as well. Here’s the Project file I’m referencing: StatusBarBug.zip

To see the bug for yourself launch the demo project in iPad Simulator. Tap the screen to show the black status bar. Then rotate the simulator once. Tap the screen again to hide the status bar. Behind it this gray bar appears.

This is how the screen looks like with the extraneous status bar showing.

Iif you set the navigation controller’s root view controller already in the NIB (as it’s usually the case) then this behavior does not occur. So for this demo I moved the view controller outside of the navigation controller.

If you don’t instantiate the navigation controller via a NIB file, but instead put the following code into the applicationDidFinishLaunching, then you will not see this extra bar.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
	// could also initWithRootViewController, same effect
 	navController = [[UINavigationController alloc] init];
	navController.wantsFullScreenLayout = YES;
	navController.navigationBar.hidden = YES;
	[navController pushViewController:viewController animated:NO];
	[window addSubview:navController.view];
	[window makeKeyAndVisible];
	return YES;

This leads me to the conclusion that something funny is happening when getting your navigation controller from a xib (without root view controller set) versus instantiating it in code. Which prompted me to file this bug. If you find that it is actually something that I am doing wrong here, please let me know.

Tap&Hold for TableView Cells, Then and Now

It was before SDK 3.2 that I developed a technique to add tap-and-hold interactivity to your tableview cells. In this article I’ll demonstrate the old technique, which still works, and contrast it with how much easier it has become if you can target iOS 3.2 and above.

First the “old way”. It needs to customize touch handling for the tableview cells themselves, which means you have to subclass UITableViewCell.

Read more

MyAppSales for Partners

A user of MyAppSales approached me and asked for the possibility to pre-configure the app such that he could give it to a partner of his. The goal was twofold:

  1. Pre-configure the account for iTunes Connect such that you don’t have to give your credentials to your partner
  2. Filter sales reports such that only the apps come through that the partner is receiving a share of sales for

… and all of this without impacting the other features like review downloading.

Since I have such a partner myself for which I’m now publishing 3 apps, I sat down and – after fighting with Xcode over a second target – added a couple of lines to the MyAppSales trunk to enable the “Partner Version”.

In the PCH file you enable and configure this special version by removing the // in front of the first define. Then you need to specifying your ITC credentials and an NSSet of Apple App Identifiers.

// to enable the partner version, re-enable the following define and fill in the three values below
#define PARTNERVERSION_ITC_LOGIN @"account@server.com"
#define PARTNERVERSION_FILTER_APPS_SET [NSSet setWithObjects:@"335519920", @"329678407", @"374457741", nil]

I’ve added a filter for the specified PARTNERVERSION_FILTER_APPS_SET in two places to ignore all lines on sales report where neither the Apple Identifier nor the Parent ID is in this list. Since the app never sees any apps outside of this filter those also won’t pop up on the apps page.

For the preconfigured account, the app adds this ITC account if there are no accounts defined. So if your partner were to remove this account accidentally it would be configured once more on next app start.

All you need to do after configuring and building a release version is to zip and ship the app and provisioning profile to your partner. Easy enough?


You have AdMob ads in your apps? Wondering if you could make a bit more money if you also had iAds were available?

DTBannerManager solves this problem for you. It allows for easily adding both networks to your code. Under iOS 4 it will first try to get an iAd because those also pay for just being displayed. If none is available then it automatically switches to AdMob, so your banner space is never wasted. It also features elegant sliding in and out of the banners and is able to display ad banners even over a tab bar controller, so they are always visible for maximum effect.

You might argue that there are free ad networks out there who promise to do exactly this for free. So why would you want to get this component from me. Well, from you you get full source code and you see exactly what is happening. Also there is no server-side ad mediation happening that might get you in trouble with Apple. I believe that as developer you don’t want to involve too many additional parties and introduce too many external dependencies. With DTBannerManager you continue own all parts of your code and have full transparency.

What’s also great is that you can use this component will work on both 3.x and 4.x iOS Versions. This way you can target the broadest possible audience with reaping the benefits of iAds if available.

Adding advertising is exceedingly simple:

	[[DTBannerManager sharedManager] addAdsToViewController:tabBarController];

Then you can just subscribe to the notifications to adjust the viewing area of your view controllers.

DTBannerManager is proving it’s worth already in GeoCorder [FREE]. There was a bug preventing “clicking through” in Ads that I have since fixed. The component is available through the Dr. Touch’s Parts Store.