According to Apple\'s documentation, in order to make phone call from my app, I need to implement the following protocols:
HTML link:
Behavior does differ between calling -[UIApplication openURL:]
with a tel:
URL, and clicking a link to the same URL in a UIWebView
.
Using a UIWebView
instead of a UILabel might have some downsides, but you don't have to actually display the UIWebView
to get its tel
URL handling behavior. Instead, just load a tel
URL request in an instance of UIWebView without adding it to your view hierarchy.
For example:
#import
#import
@interface PhoneCaller : NSObject
{
@private
UIWebView *webview;
}
- (void)callTelURL:(NSURL *)url;
@end
@implementation
- (id)init
{
self = [super init];
if (self)
{
webview = [[UIWebView alloc] init];
}
return self;
}
- (void)callTelURL:(NSURL *)url
{
[webview loadRequest:[NSURLRequest requestWithURL:url]];
}
- (void)dealloc
{
[webview release];
[super dealloc];
}
@end