Reputation: 14886
Has something changed recently in iOS? I've been able to call the following in the past:
BOOL twitter = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://user?screen_name=username"]];
if (twitter) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://user?screen_name=username"]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.twitter.com/username"]];
}
What this would do is basically check whether the device responds to the URL (if the app is installed or not) and open the app if it's installed, otherwise do else
When I test on my device (iPhone 4, 4.3.2) it opens the Twitter app when creating the BOOL.
Thanks
Upvotes: 3
Views: 6324
Reputation: 18670
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:yourURL];
Upvotes: 11