I'm writing an iPhone application that provides a button to call a phone number. I'm using code like the following to dial the number using a tel:
URL in the usual way:
NSURL* contactTelURL = [NSURL
URLWithString:[NSString
stringWithFormat:@"tel:%@",
contactTel]];
[[UIApplication sharedApplication] openURL:contactTelURL];
It works fine on a real iPhone, but I just get an 'Unsupported URL' alert in the simulator. Presumably that would also happen on an iPod Touch, though I haven't tested that. It would be nice to remove the button when running on a device that won't make calls.
Is there a way to detect programatically whether a Cocoa Touch device can make phone calls?