Making a call programmatically from iPhone app and returning back to the app after ending the call

后端 未结 6 1003
你的背包
你的背包 2020-12-03 15:25

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 allo         


        
相关标签:
6条回答
  • 2020-12-03 16:04

    following code will not return to your app [no alertview will show before make call]

    UIWebView *callWebview = [[UIWebView alloc] init];
    NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel://%@",phoneNumber]];
    [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
    

    following code will return to your app "alertview will show before make call"

    UIWebView *callWebview = [[UIWebView alloc] init];
    NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:@"telprompt://%@", phoneNumber]];
    [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
    
    0 讨论(0)
  • 2020-12-03 16:08

    You can also use webview, this is my code :

    NSURL *url = [NSURL URLWithString:@"tel://123-4567-890"];
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(50, 50, 150, 100)];
    [self.view addSubview:btn];
    UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(50, 50, 150, 100)];
    webview.alpha = 0.0;        
    [webview loadRequest:[NSURLRequest requestWithURL:url]];
    // Assume we are in a view controller and have access to self.view
    [self.view insertSubview:webview belowSubview:btn];
    [webview release];
    [btn release];
    
    0 讨论(0)
  • 2020-12-03 16:15
    UIWebView *callWebview = [[UIWebView alloc] init];
    NSURL *telURL = [NSURL URLWithString:@"tel:+9196815*****"];
    [callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];
    

    Please try this it will definitely let you Back to Your App.

    0 讨论(0)
  • 2020-12-03 16:16
    NSString *phoneNumber =  // dynamically assigned
    NSString *phoneURLString = [NSString stringWithFormat:@"tel:%@", phoneNumber];
    NSURL *phoneURL = [NSURL URLWithString:phoneURLString];
    [[UIApplication sharedApplication] openURL:phoneURL];
    
    0 讨论(0)
  • 2020-12-03 16:17

    This is my code :

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

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

    0 讨论(0)
  • 2020-12-03 16:19

    It's not possible to return back to the app after ending a call because it's an app.

    0 讨论(0)
提交回复
热议问题