iPad Programming: Maintaining Two Code Bases

iPad Programming: Maintaining Two Code Bases

Now that Apple has started selling the iPad and the NDA lifted on the iPhone 3.2 SDK, it is time for developers to start developing iPad applications. And for a large number of developers, developing iPad applications means porting their existing applications to the iPad platform.

Though the iPad is also running the iPhone OS, there are some subtle differences that developers need to look out for when porting their applications over to the new device. This article, the second of two, examines another way that you can port your existing iPhone apps to the iPad. The first article, “iPad Programming: Port Your iPhone Apps, Part I,” dealt with two methods: supporting both the iPhone and iPad platforms, and creating universal applications.

Method 3: Maintaining Two Code Bases

The third method of developing your application for multiple devices is to maintain separate targets for your application. Using this approach, you will have two executables eventually — one for iPhone/iPod touch, and one for iPad. The following steps will show you how to accomplish this. Using Xcode, create a View-based Application (iPhone) project and name it MyAppiPhone. Expand on the Targets item and select the MyAppiPhone item. Select Project’Upgrade Current Target for iPad …In the dialog, select the “Two device-specific applications” option and click OK (see Figure 1). Figure 1. Selecting the device-specific option.Observe the following items created by Xcode (see Figure 2). Figure 2. Examining the files created by Xcode.Two sets of resources and targets will be created for you — one for iPhone and one for iPad. You need to maintain two separate sets of files for each platform.To test the application on the iPhone Simulator, select iPhone Simulator 3.1.3 (under the Active SDK; see Figure 3) and MyAppiPhone (under Active Target).

Figure 3. Selecting the SDK and target to test.Press Command-R. Your application will run as an iPhone application (see Figure 4). Figure 4. The application running on the iPhone Simulator.To test the application on the iPad Simulator, select iPhone Simulator 3.2 (under the Active SDK; see Figure 5) and MyAppiPhone-iPad (under Active Target).

Figure 5. Selecting the SDK and target to testPress Command-R. Your application will run as an iPad application (see Figure 6). Figure 6. The application running on the iPad Simulator.Like the Universal application approach, you need to maintain two sets of resources. In this example, both the XIB files are connected to the same view controller (MyAppiPhoneViewController). However, it does have two separate targets – one for the iPhone and one for the iPad. Because of this, there will be two separate executables for your application.


In these two articles, you have seen how to port an existing iPhone application to support both the iPhone and the iPad. In general, the Universal application approach is the recommended one as it allows you to maintain just one code base that can target multiple platforms.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes