以编程方式从iPhone应用程序拨打电话,并在结束通话后返回到该应用程序 [英] Making a call programmatically from iPhone app and returning back to the app after ending the call

查看:100
本文介绍了以编程方式从iPhone应用程序拨打电话,并在结束通话后返回到该应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过我的iPhone应用程序发起呼叫,并且我是通过以下方式进行的.

I am trying to initiate a call from my iphone app,and I did it the following way..

-(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];
    }
}

通过上面的代码.. 我能够成功拨打电话..但是当我结束通话时,我无法返回到我的应用

by the above code..I am able to successfully make a call..but when I end a call,I'm not able to return to my app

所以,我想知道如何实现.也请告诉我如何使用webview发起呼叫...

So, I want to know how to achieve,that..also please tell me how we can initiate a call using webview...

推荐答案

这是我的代码:

NSURL *url = [NSURL URLWithString:@"telprompt://123-4567-890"]; 
[[UIApplication  sharedApplication] openURL:url]; 

使用此功能,以便在通话结束后返回到应用.

Use this so that after call end it will return to app.

这篇关于以编程方式从iPhone应用程序拨打电话,并在结束通话后返回到该应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆