To register a URL type for your app
Include the CFBundleURLTypes key in your app’s Info.plist file. The CFBundleURLTypes key contains an array of dictionaries, each of which defines a URL scheme the app supports.
Call the URL (registered as above)
NSURL *myURL = [NSURL URLWithString:@"todolist://www.acme.com?Quarterly%20Report#200806231300"];
[[UIApplication sharedApplication] openURL:myURL];
Handle Calls to Custom URL Schemes
An app that has its own custom URL scheme must be able to handle URLs passed to it. All URLs are passed to your app delegate, either at launch time or while your app is running or in the background. To handle incoming URLs, your delegate should implement the following methods:
Use the application:willFinishLaunchingWithOptions:
and application:didFinishLaunchingWithOptions:
methods to retrieve information about the URL and decide whether you want to open it. If either method returns NO, your app’s URL handling code is not called.
In iOS 4.2 and later, use the application:openURL:sourceApplication:annotation:
method to open the file.
In iOS 4.1 and earlier, use the application:handleOpenURL:
method to open the file.
If your app is not running when a URL request arrives, it is launched and moved to the foreground so that it can open the URL. The implementation of your application:willFinishLaunchingWithOptions:
or application:didFinishLaunchingWithOptions:
method should retrieve the URL from its options dictionary and determine whether the app can open it. If it can, return YES and let your application:openURL:sourceApplication:annotation:
(or application:handleOpenURL:
) method handle the actual opening of the URL. (If you implement both methods, both must return YES before the URL can be opened.)
If your app is running but is in the background or suspended when a URL request arrives, it is moved to the foreground to open the URL. Shortly thereafter, the system calls the delegate’s application:openURL:sourceApplication:annotation:
to check the URL and open it. If your delegate does not implement this method (or the current system version is iOS 4.1 or earlier), the system calls your delegate’s application:handleOpenURL:
method instead.
Note
If two or more applications have registered the same Custom URL, there is no guarentee of which application the iOS will open if the Custom URL is called.
Further Reading
iOS App Programming Guide :: Advanced Tips and Trics