In addition to adding new iPad-specific features such as pop-overs and split views, iPhone OS 3.2 adds support for Universal apps. What is a Universal App? when making Universal Apps users will be able to buy your app only once and they will get versions optimized for each device.

First, you need to understand what each Universal App Build Settings does, there are several build settings which work together to affect the devices on which a Universal app can run.

• Targeted Device Family — defines which devices your app is built to support
- Universal applications must specify "iPhone/iPad"
- Applications that only intend to run on iPad should specify "iPad".

• Base SDK — defines which version of the physical frameworks on disk are used to build your app (this should always be the newest SDK)

• iPhone OS Deployment Target — the minimum version of iPhone OS an application is designed to run on.
- Typically, choose the earliest OS version that includes all of the functionality your application needs to run.
- Universal apps must set this value to no less than iPhone OS 3.0, and no more than iPhone OS 3.1.3

Your build setting should look similar to this:




Now that your settings are correct, you need to add some Info.Plist Device-Specific Entries.

To make Universal Apps, you need MainWindow.xib nib file for each device (one for iPhone/iPod Touch, one for iPad), tell your application to use a different MainWindow.xib for different devices we can add a key called NSMainNibFile~ipad and then specify the name of the nib file to use when launching on an iPad. For the iPhone and iPod touch, it will continue to use the default value, MainWindow.xib, but for the iPad, it will use the nib file you've specified in the new, device-specific key.

You can add a new version of MainWindow.xib to your project by selecting the Resources group and choosing Add New File from the File menu. From the New File Assistant, select User Interface from under the iPhone OS, then select Application XIB, and make sure you select the right device in the Product drop-down.




Programmatically Determining Device

When writing Universal Applications, sometimes there are device specific code that you want to only to be executed for specific device, for example, I want to support 4 orientations only for the iPad version, I can use the following code:

Code:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

#endif

In part 2, I'll cover working with the User Interface.