Reputation: 461
How can I make a phone call in my app to a number that's been input to a UITextField
?
Upvotes: 1
Views: 1230
Reputation: 22767
You should be able to call openURL:
or openURL:options:completionHandler:
with a "tel:" protocol. See the Phone Links section of the protocol reference. In iOS 3.x you will see a prompt though in iOS 2.x it will just dial.
Upvotes: 6
Reputation: 3138
NSString *callTextFiel = [NSString StringWithFormat:@"tel:%@", textField.text];
[[UIApplication SharedApplication] openURL:[NSURL URLWithString:callTextField]];
Upvotes: 1