2010-08-26 93 views

回答

1

看到这个主题,你可以从那里的代码片段如用它 making a phone call w/o quitting an appication

请记住,它可能只能从iOS版3.1。如果您的目标是iOS 3.0,则无法退出应用程序。

NSString *callString = [NSString stringWithFormat:@"tel:%@", @"412-33-44-55"]; 
NSURL *url= [NSURL URLWithString:callString]; 

NSString *osVersion = [[UIDevice currentDevice] systemVersion]; 

if ([osVersion compare: @"3.1" options: NSNumericSearch] >= NSOrderedSame) { 
    UIWebView *webview = [[UIWebView alloc] initWithFrame:[callButton frame]]; 
    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:callButton]; 
    [webview release]; 
} 
else { 
    // On 3.0 and below, dial as usual 
    NSString * s = [NSString stringWithFormat:@"tel://%@",@"412-33-44-55"]; 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:s]]; 
} 
+0

哎,wher是该链接指向??后登录它去iPhone开发者,让我们开始讨论页面:( – VinuthnaS 2010-08-26 09:39:18

+0

你需要打开这个线程之前,你的开发人员凭据登录。该片段是在一个最后一条消息我可以在输入我的iPhone开发凭证后到达线程让我知道如果你不能得到它我会在这里复制/粘贴它,但是你不能用模拟器尝试它,只能安装3.1或更高版本的设备 – 2010-08-26 11:37:30

+0

嗨Nava Carmon,我已经进入了我的凭据,它的接受ñ再次指导我到同一页..你可以请复制/粘贴在这里... – VinuthnaS 2010-08-26 11:48:13

相关问题