从iphone应用程序以编程方式拨打电话,并在结束通话后返回应用程序

Ran*_*jit 8 iphone objective-c ios4 ios

我正试图从我的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];
    }
}
Run Code Online (Sandbox Code Playgroud)

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

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

谢谢和问候Ranjit

San*_*gar 18

这是我的代码:

NSURL *url = [NSURL URLWithString:@"telprompt://123-4567-890"]; 
[[UIApplication  sharedApplication] openURL:url]; 
Run Code Online (Sandbox Code Playgroud)

使用这个,以便在通话结束后它将返回到应用程序.