相关疑难解决方法(0)

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

我正试图从我的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

iphone objective-c ios4 ios

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×1

ios4 ×1

iphone ×1

objective-c ×1