iPhone SDK:在通话结束后启动应用程序 [英] iPhone SDK: Launching an app after call ends
本文介绍了iPhone SDK:在通话结束后启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在应用程序内拨打电话或在通话结束后立即启动应用程序?我知道这是可能的,因为应用程序商店中的某些应用程序已经在执行此操作。
How would I make a call from within an app or launch an app immediately after the call ends? I know this is possible because some apps in the app store are already doing this.
推荐答案
我从Apple网站获取此代码,它运作完美:
I got this code from Apple site and it works perfectly:
-(IBAction) dialNumber:(id)sender{
NSString *aPhoneNo = [@"tel://" stringByAppendingString:[itsPhoneNoArray objectAtIndex:[sender tag]]] ; NSURL *url= [NSURL URLWithString:aPhoneNo];
NSURL *url= [NSURL URLWithString:aPhoneNo];
NSString *osVersion = [[UIDevice currentDevice] systemVersion];
if ([osVersion floatValue] >= 3.1) {
UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
[webview loadRequest:[NSURLRequest requestWithURL:url]];
webview.hidden = YES;
// Assume we are in a view controller and have access to self.view
[self.view addSubview:webview];
[webview release];
} else {
// On 3.0 and below, dial as usual
[[UIApplication sharedApplication] openURL: url];
}
}
这篇关于iPhone SDK:在通话结束后启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文