Hi,
This might be a very simple thing for iPhone development purpose, but, sadly, though, I haven't been able to properly figure out how to programmatically dial a phone number and invoke the emailing phone applications, from my native application!
I've tried using the Apple URL schemes, in this regard, but it didn't help me much.
For dialing a number I'm using the following code:
where currentTitle is the telephone number I want my application to dial. But all its doing is throw an alert:
Unsupported URL. The URL wasn't loaded: tel:9xx-xxx-xxxx
I've even tried tel://<tel. number> instead of tel:<tel. number> thinking that the scheme might have changed after iPhone OS 2.0 release, but to no avail.
The same is with the email app, invocation. I'm using the the following code for that purpose:
where again currentTitle is the email id I want my application to mail to. Its throwing me the same alert. I've even tried mailto://<email-id>, with no success.
I'm referring to the following the documentation in this regard:
https://developer.apple.com/iphone/...eURLScheme_Reference/Articles/PhoneLinks.html
What am I doing wrong over there? Kindly enlighten me.
Thanks for reading through.
This might be a very simple thing for iPhone development purpose, but, sadly, though, I haven't been able to properly figure out how to programmatically dial a phone number and invoke the emailing phone applications, from my native application!
I've tried using the Apple URL schemes, in this regard, but it didn't help me much.
For dialing a number I'm using the following code:
Code:
NSString *callToURLString = [NSString stringWithFormat:@"tel:%@", [(UIButton*)sender currentTitle]];
if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:callToURLString]])
{
// there was an error trying to open the URL. We'll ignore for the time being.
}
Unsupported URL. The URL wasn't loaded: tel:9xx-xxx-xxxx
I've even tried tel://<tel. number> instead of tel:<tel. number> thinking that the scheme might have changed after iPhone OS 2.0 release, but to no avail.
The same is with the email app, invocation. I'm using the the following code for that purpose:
Code:
NSString *emailIDString = [NSString stringWithFormat:@"mailto:%@", [(UIButton*)sender currentTitle]];
if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:emailIDString]])
{
// there was an error trying to open the URL.
//for the time being we'll ignore it.
}
I'm referring to the following the documentation in this regard:
https://developer.apple.com/iphone/...eURLScheme_Reference/Articles/PhoneLinks.html
What am I doing wrong over there? Kindly enlighten me.
Thanks for reading through.