The Anatomy of an iPhone 4 (iOS 4 Xcode 4)

From Techotopia
Jump to: navigation, search
PreviousTable of ContentsNext
About iPhone iOS 4 App Development Essentials - Xcode 4 EditioniOS 4 Architecture and SDK Frameworks (iOS 4 Xcode 4)

Purchase the fully updated iOS 12 / Xcode 10 edition of this book in eBook format for only $24.99.
iOS 12 App Development Essentials eBook (ePub/PDF/Kindle) edition contains over 120 chapters. Learn more...

Buy Print Preview Book

Most books covering the development of apps for the iPhone tend to overlook the underlying hardware of the device and instead dive immediately into the software development environment. This is a shame because the iPhone is an incredible technical achievement that we are already starting to take for granted.

Take, for example, the iPhone 4. This is a sleek device that is 115.2mm long, 58.6.1mm wide and 9.3 mm deep and weighs a mere 137 grams. Now, compare the size of your laptop or desktop computer to your iPhone. Then take a look at the specification for your computer and see if it has built in GPRS, EDGE and 3G wireless support, a digital compass, GPS, an accelerometer, a gyroscope, a proximity sensor, an ambient light sensor, Bluetooth capability, Wi-Fi, a multi-touch screen, a vibration generator and a 5 megapixel autofocus camera with built in flash and a second, 30 frame per second front facing camera. The chances are your much larger and heavier computer has only a small subset of these features. Next, check the expected battery life of your laptop and see if will allow you to play music for 40 hours or video for 10 hours, or talk non-stop to a friend for 14 hours without needing a recharge. When you consider these capabilities you will hopefully begin to appreciate the engineering achievements behind the iPhone and other similar smartphone devices.

Now that we have set the scene, we can move on to discuss some of the hardware features built into the iPhone in a little more detail. Once again, we will do this within the context of the iPhone 4.

iOS 4

Before we delve into the hardware of the iPhone we will start by talking about the operating system that sits on top of all the hardware. This operating system is called iOS 4 and is a variant of Apple’s Mac OS X operating system that has been adapted to run on the iPhone. It is built upon a “UNIX-like” foundation called Darwin and consists of the Mach kernel, core services and media layers and the Cocoa Touch interface. iOS 4 is covered in greater detail in the chapter entitled iOS 4 Architecture and SDK Frameworks.


The iPhone 4 has a 3.5 inch display with a resolution of 960 x 640 pixels capable of displaying 326 pixels per inch (ppi) with an 800:1 contrast ratio. The underlying technology is an In Plane Switching (IPS) LED, capacitive touch screen. The screen has a scratch and oil and fingerprint resistant oleophopic coated surface and includes a proximity sensor that automatically turns off the screen when you put the phone to your ear (presumably to extend the battery life during a phone call and to avoid making user interface selections with your ear or the side of your face). The device also has ambient light detection that adjusts the screen brightness to ensure the optimal screen visibility in a variety of lighting conditions from bright sunlight to darkness.

Wireless Connectivity

The iPhone 4 supports a wide range of connectivity options. When within range of a Wi-Fi network, the device can connect at either 802.11b, 802.11g or 802.11n speeds.

For making phone calls or transferring data when not connected to Wi-Fi, the AT&T device supports GSM/EDGE connectivity (otherwise known as 2G). For faster speeds, support is also provided for connectivity via Universal Mobile Telecommunications System (UMTS), High-Speed Downlink Packet Access (HSDPA) and High Speed Uplink Packet Access (HSUPA). This is better known as 3G and provides data transfer speeds of up to 7.2 megabits per second.

The iPhone 4 also includes Bluetooth v2.1 support with Enhanced Data Rate (EDR) technology.

Wired Connectivity

Given the wide array of wireless options it is not surprising that the iPhone has little need for wired connections. In fact the iPhone only has two. One is a standard 3.5 mm headset jack for the attachment of headphones or other audio devices. The second is a proprietary, 30-pin dock connector that, by default, is used to provide a USB v2.0 connection for synching with a computer system and battery charging. In practice, however, this connection also provides audio and TV output via specialty third party cables.


The iPhone 4 comes in two editions, one with containing 16GB of memory and another with 32GB. The memory is in the form of a flash drive. Unlike some devices, the iPhone lacks the ability to supplement the installed memory by inserting additional flash memory cards.


The iPhone 4 contains a 5 megapixel autofocus still camera that may also be used to record video at an HD resolution of 720p at a rate of 30 frames per second (fps). In addition, the device also incorporates an LED flash and a VGA resolution, 30 fps front facing camera.


The latest generation of iPhone has an array of sensors that would make even the most die-hard 1960s science fiction fan jealous. These consist of a proximity sensor that detects when the front of the phone is covered or otherwise obscured, an accelerometer that uses the pull of gravity to detect when the device is moved or rotated, a three-axis gyroscope and an ambient light sensor that detects current environmental light levels.

Location Detection

The iPhone 4 contains a digital compass and GPS support with Assisted GPS (A-GPS) support. Essentially this enables the iPhone to detect the direction the device is facing and to identify the current location by detecting radio signals from GPS satellites. In the event that GPS signals are unavailable or too weak to establish the current coordinates, the iPhone can also gain an approximate location using cellular and Wi-Fi information.

Central Processing Unit (CPU)

<google>IOSBOX</google> The central processing unit (CPU) of the iPhone 4 is the Apple A4, an Apple designed system-on-a-chip (SoC) consisting of an ARM Cortex A8 chip combined with an Imagination Technologies PowerVR Graphics Processing Unit (GPU). This Cortex A8 processor is designed by a British company called ARM Holdings that specializes in designing chips and then licensing those designs to third parties who then manufacture them. This differs considerably from the approach taken by companies such as Intel who both design and manufacture their own chips.

The Cortex A8 chip is based on the ARMv7 processor architecture and was chosen by Apple for its combination of high performance and low power requirements.

Graphics Processing Unit (GPU)

As previously mentioned, iPhone 4 graphics are handled by an Imagination Technologies PowerVR SGX 535 Graphics Processing Unit (GPU). This is also the same GPU that is built into the iPad and provides support for OpenGL ES 1.1/2.0 (a lightweight version of SGI’s OpenGL platform), OpenGL 2.0/3.0 and OpenVG 1.1 and DirectX 9/10.1 graphics drawing and manipulation and includes the Universal Scalable Shader Engine (USSE), all key requirements for graphics intensive games development. The older iPhone 3G contains the PowerVR MBX GPU which only supports OpenGL ES 1.1 and OpenVG 1.0.

Speaker and Microphone

As with most other phones on the market, the iPhone includes both a built-in microphone and a speaker to enable the use of the device as a speakerphone. Both the speaker and microphone may be used by third party apps, though as is to be expected with a device the size of an iPhone, the sound quality of the speaker is widely considered to be poor.


Though initially provided as a “silent ring” feature whereby the device vibrates to indicate an incoming call as an alternative to a ring tone (a feature common to most mobile phone devices), the vibration feature of the iPhone may also be used within applications to notify the user of a new event (such as a breaking news story) or to provide tactile feedback such as for an explosion in a game.


As we have seen in this chapter, the iPhone packs an impressive amount of technology into a very small amount of space. Perhaps the most exciting aspect of all this technology is that you can, almost without exception, access and utilize all this hardware within your own applications.

Purchase the fully updated iOS 12 / Xcode 10 edition of this book in eBook format for only $24.99.
iOS 12 App Development Essentials eBook (ePub/PDF/Kindle) edition contains over 120 chapters. Learn more...

Buy Print Preview Book

PreviousTable of ContentsNext
About iPhone iOS 4 App Development Essentials - Xcode 4 EditioniOS 4 Architecture and SDK Frameworks (iOS 4 Xcode 4)