iOS 撥打電話三種方法

iOS 撥打電話的三種方法

1.這種方法,撥打完*****回不到原來的應用,會停留在通訊錄里,而且是直接撥打,不彈出提示

NSMutableString *str=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];

NSLog(@"str======%@",str);

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

2.這種方法,打完*****后還會回到原來的程序,也會彈出提示,推薦這種

NSMutableString *str2=[[NSMutableString alloc] initWithFormat:@"tel:%@",@"186xxxx6979"];

NSLog(@"%@",str2);

UIWebView * callWebview = [[UIWebView alloc] init];

[callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str2]]];

[self.view addSubview:callWebview];

3.這種方法也會回去到原來的程序里(注意這里的telprompt),也會彈出提示

NSMutableString *str3=[[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"186xxxx6979"];

NSLog(@"str======%@",str3);

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str3]];

注:用第3個的時候要小心,因為apple的文檔里邊沒出現過telprompt這個。之前是有過被reject的案例。本文轉自:http://www.cocoachina.com/bbs/read.php?tid=177141

本文永久地址:http://blog.it985.com/17171.html

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容