tags:

views:

103

answers:

1

Is there some why my application can query the URL handlers that have been installed / are supported?

The use case here is that I'd like my app to allow users to send tweets using either its built in tweeting, or by using their preferred twitter client. I'd like to let them select the client from a list of those that they have on the phone (or show a list with those they have installed highlighted, or something). Another app I plan to write would also benefit from being able to check for available handlers to then provide integration possibilities to its user.

Thanks, Benjohn

+4  A: 

You can only find if there is a handler for a given URL via UIApplication.canOpenURL::

NSURL *url = [NSURL urlWithString:@"http://example.com"];
BOOL tweet = [[UIApplication sharedApplication] canOpenURL:url];

Unfortunately, you cannot query for all the handlers or know which application handles which urls.

notnoop
Thanks notnoop, I just bumped in to this in the docs, and it looks perfect. Good reply!
Benjohn Barnes
Works fine .. small correction thou - should be: URLWithString instead of:urlWithString. Just small typo ;-)
Lukasz