iPhone OS Fragmentation.

Apple Lists iPhone OS 4 Compatibility, Excludes Original iPhone and 1st Gen iPod Touch

Up until now the biggest advantage of the iPhone ecosystem is that you could simply code for the latest OS version to ship, and unless you needed certain hardware (such as the camera in the iPhone), you just wrote your software and you could guarantee that you could run on whatever platform you wanted.

This represents a serious advantage to the iPhone development model over Android, where currently shipping phones contain every OS version from v1.6 to v2.1, or Windows Mobile which has a similar spread of currently shipping versions from 6.0 to 6.5.

The first crack in this came from OpenGL support–but that made sense: only the latest 3rd generation iPod Touch or iPhone 3GS would have the hardware necessary to support OpenGL ES v2.0 instead of v1.1. The differentiation could be handled (for the most part) during initialization. And really, this only affects 3D games.

The next crack came with the introduction of the iPad. When the iPad was announced as running iPhone OS 3.2, I just naturally assumed within a week of the iPad launch we’d see an iPhone OS 3.2 update come out for the iPhone and iPad Touch which perhaps provided some minor APIs used to detect screen size, and maybe wrap some of the new UI calls with stubs that alert the developer. Well, Apple released build tools that make it possible to ship code that can run on v3.1 or v3.2, and at run time detect if the symbols are available. The work is relatively simple: from my code I just wrote:

- (IBAction)doOptions:(id)sender
{
	NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"OptionsViewMenu" owner:self options:nil];
	OptionsViewController *ctrl = [array objectAtIndex:0];
	ctrl.menu.delegate = self;
	
	if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
		if (popup != nil) [popup release];
		
		Class uiPopoverController = NSClassFromString(@"UIPopoverController");
		
		popup = [[uiPopoverController alloc] initWithContentViewController:ctrl];
		ctrl.popup = popup;
		CGRect loc = ((UIView *)sender).bounds;
		[popup presentPopoverFromRect:loc inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
	} else {
		ctrl.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
		[self presentModalViewController:ctrl animated:YES];
	}
}

My options user interface view controller now shows up in a pop-up on the iPad, and drills down (with a rotation animation) on the iPhone. To get the size right I simply included in my options view controller the following code in -viewDidLoad:

	if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
		CGSize size = self.contentSizeForViewInPopover;
		size.height = 44 * 10;
		self.contentSizeForViewInPopover = size;
	}

And the height is kept to a reasonable size.

Okay, I’m not a huge fan of conditional code, but honestly this only comes up in a few places, so it doesn’t affect the majority of my code base.

But now the final straw is coming with the iPhone OS v4 release in the summer. That final straw is simply this:

There will be phones in the iPhone/iPod Touch echosystem in use by users which are cannot run the latest iPhone OS operating system, which must be supported by developers if they are to reach the entire Apple iPhone/iPod Touch ecosystem.

Sure, it’s not as bad as the Android situation, where v1.6 of the operating system is shipping in hardware being sold today. (The Cliq and G1, specifically.) But it’s still a problem: as a developer it means I need to maintain older hardware to validate that my software runs in v3.1.3 which will probably be the latest version of the iPhone OS that can run in older hardware.

And worse: Apple announced that Multitasking will only run on the 3rd generation hardware. Which means all those applications that want to take advantage of multitasking will need to have code in place to deal with hardware that doesn’t have multitasking calls available to deal with the large numbers of iPhone 3G devices (such as mine) floating around out there.

Apple’s fragmentation perhaps could be seen as inevitable. But I don’t think so: at the very least ship a version of the iPhone OS v4 that runs on the basic hardware that has the appropriate calls to allow software to detect features that are not present, like multitasking. Provide a way in the simulator to easily test against older versions. And because the number of hardware combinations is growing substantially that need to be tested, provide an easier way to distribute beta test code. (If Apple won’t allow applications to be shipped outside of the App Store, then at least provide a “beta” section of the Apple Store that is not linked to the main Apple Store home page, with applications in beta testing that can only be linked to via an explicit URL.)

Apple’s ecosystem is large and powerful–but it’s still a little young, and experiencing some growing pains. This is the biggest growing pain: how do developers deal with a non-homogeneous hardware and OS ecosystem? Once we adjust to the iPad and iPhone, the next step will be dealing with a third size form-factor, or different iPhone screen sizes. But that won’t be overcome until Apple can help reduce the testing burden–which is the biggest problem you have when you have a non-homogeneous target environment.

This entry was posted in iphone, Objective C++. Bookmark the permalink.