How can I make a phone call programmatically on iPhone? I tried the following code but nothing happened:
NSString *phoneNumber = mymobileNO.titleLabel.text;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
How can I make a phone call programmatically on iPhone? I tried the following code but nothing happened:
NSString *phoneNumber = mymobileNO.titleLabel.text;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
If you are using Xamarin to develop an iOS application, here is the C# equivalent to make a phone call within your application:
In Swift 3.0,
Merging the answers of @Cristian Radu and @Craig Mellon, and the comment from @joel.d, you should do:
This will first try to use the "telprompt://" URL, and if that fails, it will use the "tel://" URL. If both fails, you're trying to place a phone call on an iPad or iPod Touch.
Swift Version :
Tried the Swift 3 option above, but it didnt work. I think you need the following if you are to run against iOS 10+ on Swift 3:
Swift 3 (iOS 10+):
Swift 3
The answers here are perfectly working. I am just converting Craig Mellon answer to Swift. If someone comes looking for swift answer, this will help them.