How can we make phone calls programmatically without using the code
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://942345开发者_开发百科6789"]];
The method you've suggested is the only means of programmatically requesting that a call is placed.
If you're attempting to subvert the user's acceptance of the call, then this isn't possible using the public APIs.
So do this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://9423456789"]];
Then create a local notification that pops up in 1 seconds to bring the user back to your app.
The only way to make a call completely within your own application is to create your own VoIP-like solution. You can't make cellular phone calls within your own app.
It's completely user-controllable and, just like sending SMS and email, should stay that way. There were too many applications for Windows Mobile for example, which would send premium SMS behind user's back.
@Prasanth T R
But the my app is switching to the Phone app and it's cannot turn back to my app after ending the call. I need the call to be made within my app
To go back to your app, use telprompt://9423456789 instead of tel://9423456789
using "telprompt://" when a call finish the user will go back to your app
NSString *phoneDigits = @"9423456789";
NSString *phoneNumber = [NSString stringWithFormat@"telprompt://%@",phoneDigits];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]]
精彩评论