Image Picker w/ UIPopoverController (setRootViewController:)


In the second printing of the book, you are asked to write code to use a UIPopoverController to present a UIImagePickerController for the iPad. If you run the code on the iPad (or iPad simulator), you’ll get an unrecognized selector exception; -[UIWindow setRootViewController:].

While the reason for this is explained in the UIViewController/UITabBarController chapter, it might be confusing as I forgot to explicitly put the line of code to fix this exception in the book.

In application:didFinishLaunchingWithOptions:, replace the following two lines:

[window setRootViewController:navController];
[navController release];


[window addSubview:[navController view]];

In November, when 4.2 comes out for the iPad, you will not need to do this.