The iPhone 4 is arguably the most significant hardware refresh since the iPhone 3G and OS 2.0 were released, which gave developers first access to an SDK and APIs for developing native applications. As a result, while there is not necessarily as much new for developers as there was for OS 2.0, the changes and updates are as significant as they are subtle, both in iOS 4.0 and in the APIs made possible by the new hardware in the iPhone 4 itself.
The iPhone 4 has a 960x640 display which contains 4x as many pixels as the previous generation devices. The size of the screen has not changed, which means each pixel measures an incredibly miniscule 78 micrometers across—1/4 the size of the pixels in the previous devices. With 326 pixels per inch, the iPhone 4 presents the user with such a high resolution that the human eye is unable to distinguish individual pixels. iOS 4.0 decouples the actual screen resolution from the logical coordinate system (which maps to the screen resolution of the previous generation devices). Developers will be able to easily take advantage of this new capability while also providing as much backward compatibility to existing apps as possible. All x and y coordinates specified when drawing or manipulating views on the screen do not necessarily need to change from previous versions, but any content that is drawn is automatically scaled upward. Vector-based drawings are automatically adjusted to take advantage of every available pixel to maximize crispness, and the UIKit provides new methods for loading high-resolution variants of any images you may use within your application.
In addition to the 3-axis motion detection the accelerometer provided (up-down, left-right, forward-backward), the new gyroscope provides an additional 3 axes of motion detection (pitch, yaw, and roll). This gives the iPhone 4 full 6-axis motion detection. This extremely robust collection of interfaces is exposed by the new Core Motion framework. This opens up many new possibilities for games and many other kinds of applications that can improve the user experience through advanced motion detection. Through the Core Motion APIs, you can access either the raw underlying data of the accelerometer and gyroscope, or you can get processed data around attitude and rotation rates and changes.
The iPhone 4 includes a significantly improved 5-megapixel camera with an LED flash that also supports recording 720p High Definition video and a new front-facing VGA resolution camera. The front-facing camera is perfect for applications like FaceTime or any other app that might require a picture or video of the user. Additionally, while it has previously required the use of a private API to access a live feed of the camera, iOS 4.0 provides a significantly enhanced AV Foundation framework that offers very powerful and advanced features like movie capture, media editing, stereophonic panning, and precise sound event synchronization. With two cameras, plus these powerful new APIs, the potential for app developers is limitless.
In addition to the new features and APIs made possible by the hardware additions, the iPhone 4 also provides developers with the powerful new features of iOS 4.0:
- Multitasking – provides a background execution context and lets apps register to act as specific services that require regular background thread execution time.
- Local Notifications – gives apps the ability to give users notifications just like Push Notifications, even scheduling them in the future when the app isn't running,
- Event Kit – lets applications access a user's existing calendar events as well as create new events,
- iAd – integrates with Apple's new advertising platform for in-app marketing opportunities and additional revenue channels for developers,
- Quick Look – offers apps the ability to preview the contents of files that your app doesn't directly support, like Word, PowerPoint, or PDF files,
- Assets Library – provides query-based access to the media library of pictures and videos, and allows items to also be saved back to the library.
- Accelerate – contains methods and interfaces for performing mathematical calculations for things like extremely big numbers and digital signal processing.