iphone - 从 iPhone 应用程序以编程方式调用电话并在结束通话后返回应用程序

标签 iphone objective-c ios ios4

我正在尝试从我的 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/

相关文章:

android - 为什么 TableView (UITableView) 必须有独立的源对象来提供数据?

iphone - 控制台 UIImagePickerController 中的两阶段旋转动画警报

ios - 缺少 XCTest 框架

ios - 查找哪个单元格被单击并执行 Segue

ios - GPPSignIn 委托(delegate)方法未被执行?

ios - 分组的 UITableView 和水平边距

iphone - 取消本地通知时删除角标(Badge)编号

ios - ios上的复杂数据结构的sqlite或核心数据

ios - UIStackView 动态地在彼此旁边添加 2 个标签,没有额外的间距

iPhone sdk-在 KALViewController 中保存最后选择的日期