Reputation: 20919
I have a phone number like this: 025639879
. I got it from the database as a String
.
Now i want to make a Phone call exactly when the user click on that number, i have tried to do like this:
NSString *phoneNumber=[@"tel://"stringByAppendingString:myAppGlobalVariables.telephoneTheme];
NSString *html = [NSString stringWithFormat:@"<html><body>Téléphone:%@</body
</html>",phoneNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
[webView loadHTMLString:html baseURL:nil];
What i got in my app is this:
Téléphone:tel://025639879
Am i missing something? thanx in advance.
Upvotes: 1
Views: 1064
Reputation: 3177
You can do it in two ways:
make a <a href="tel://number">number</a>
link:
NSString *html = [NSString stringWithFormat:@"<html><body><p>Téléphone:<a href=\"tel://%@\">%@</a></p></body></html>", myAppGlobalVariables.telephoneTheme, myAppGlobalVariables.telephoneTheme];
[webView loadHTMLString:html baseURL:nil];
Upvotes: 2