How-to: building services into iPhone applications

Status
Not open for further replies.

Osiris

Golden Master
Messages
36,817
Location
Kentucky
Apple's built-in applications offer a variety of services that can be accessed via URL calls. You can ask Safari to open webpages, Maps to show a map, or use the mailto: style URL to start composing a letter in Mail. These services work because the iPhone knows how to match URL schemes with applications. A URL that starts with http: will open in Mobile Safari. The mailto: URL always links to Mail. But what you may not know is that you can define your own URL schemes and implement them in your applications. In this article, I'll show you how I implemented my own cross-application copy/paste service for the iPhone. So if you don't want to wait for for the copy/paste feature to appear in iPhone 3.0 this summer, then check it out—and even if you do want to wait, you may find it useful to know how to build services into your iPhone apps.
Twitterific and the merits of services

Take the iconfactory's Twitterific, for example. Developer Craig Hockenberry introduced a custom service on the heels of the NDA withdrawal. His twitterific: scheme lets users and third party developers launch his application and open a pre-filled, ready-to-post tweet.
This lets developers add Twitter support to their applications without any programming needed. Because Twitterific already stores sensitive user name and password information, all you have to supply is the body text. When the custom URL is invoked, control passes to Twitterific, which takes over and allows users to finish tweeting. After they're done tweeting, users quit Twitterific and can return to the original application.
These kind of services work best when they provide some kind of performance boost or data leverage. In the case of Twitterific, it's not really about tweeting; it takes very little code to tweet. But you then take on either the responsibility of securely storing user credentials or you force users to enter those credentials on each use. Using the Twitterific service lets you bypass those issues and expand the way your application works.


How-to: building services into iPhone applications - Ars Technica
 
Status
Not open for further replies.
Back
Top Bottom