【发布时间】:2011-10-29 14:41:51
【问题描述】:
我正在尝试从我的 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 发起呼叫...
【问题讨论】:
-
这个问题详细回答了你的问题。只需使用 uiwebview 来拨打电话,而不是 openURL:stackoverflow.com/questions/5317783/…
标签: iphone objective-c ios ios4