我正在尝试从我的 iPhone 应用程序发起调用,我是按照以下方式进行的......
-(IBAction) call:(id)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Call Besito" message:@"\n\n\n"
delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Submit", nil];
[alert show];
[alert release];
}
- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex
{
if (buttonIndex != [alertView cancelButtonIndex])
{
NSString *phone_number = @"0911234567"; // assing dynamically from your code
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", phone_number]]];
NSString *phone_number = @"09008934848";
NSString *phoneStr = [[NSString alloc] initWithFormat:@"tel:%@",phone_number];
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneStr];
[[UIApplication sharedApplication] openURL:phoneURL];
[phoneURL release];
[phoneStr release];
}
}
通过上面的代码..我能够成功调用电话..但是当我结束通话时,我无法返回我的应用
所以,我想知道如何实现……也请告诉我如何使用 webview 发起调用……
最佳答案
这是我的代码:
NSURL *url = [NSURL URLWithString:@"telprompt://123-4567-890"];
[[UIApplication sharedApplication] openURL:url];
使用它以便在通话结束后它会返回到应用程序。
关于iphone - 从 iPhone 应用程序以编程方式调用电话并在结束通话后返回应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7104883/