One of the most common complaints that the early iPhone programmers made was about the inability to test their applications on actual devices. How odd, you may wonder, that as the owner of the device you can’t test your apps on it, notes Wei-Meng Lee in ‘Beginning iPhone SDK: Programming with Objective-C’ (www.wileyindia.com).
Turns out that for security reasons, Apple requires all applications to be signed with a valid certificate, and for testing purposes, a developer certificate is required, he adds. “To test your application on a device, you must sign up for the iPhone Developer program and request that a developer certificate be installed onto your device. This is a lengthy process…”
Assuming you have gone through the process, another hurdle you encounter is ‘no background applications.’ Power management is a major challenge in programming mobile devices, and a badly written application can be a resource hog that drains the battery very quickly, the author reminds.
“Apple acknowledges this issue, and from reviewing experiences obtained from other platforms, decided that major culprits in hurting battery life and performance are background applications.” So how does Apple approach the problem? By disallowing applications run in the background.
While that may be an effective solution, it has irked a lot of developers, Lee observes. “Many useful applications require background operation to function correctly. For example, a chatting application needs to be running to receive messages from other users.”
Push technology
To overcome this limitation, Apple has developed its Push Notification Service, released with iPhone 3.0, and this feeds applications with data even when they are not running, he informs. “Using push technology, a device is constantly connected to Apple’s server through an IP connection. When a device needs attention, a notification is sent from Apple’s server to the device, thereby alerting the specific application that needs to service that notification.”
Yet another restriction is that you are not allowed to call third-party applications from within your application; nor can you run interpreted code from within your application, Lee cautions. “A good example involves writing a Web browser application for the iPhone. Because Web applications typically use JavaScript for client-side interactivity, this restriction by Apple means that you can’t run JavaScript code from within your application.”
Instructive read.