RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
ios开发拨打电话,ios 定时打电话

iOS拨打电话的三种方式

第一种:

创新互联公司专注于企业全网营销推广、网站重做改版、海曙网站定制设计、自适应品牌网站建设、H5场景定制商城开发、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为海曙等各大城市提供网站开发制作服务。

NSMutableString *string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"15139877951"];

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

注:拨打完电话后回不到原来的应用,会停留在通讯录里,而且是直接拨打不弹出提示。

第二种:

UIWebView *web = [[UIWebView alloc] init];[self.view addSubview:web];

NSMutableString *string = [[NSMutableString alloc] initWithFormat:@"tel:%@",@"15139877951"];

[web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:string]]];

注:拨打电话后还会回到原来的程序,也会弹出提示(推荐使用)

第三种:

NSMutableString *string = [[NSMutableString alloc] initWithFormat:@"telprompt:%@",@"15139877951"];

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

注:拨打电话后会回到原来的程序里,也会弹出提示,但是注意这里的是telprompt  

app调用手机的拨打电话功能

iOS拨打电话(三种方法)

2 . 这种方法,打完电话后还会回到原来的程序,也会弹出提示,推荐使用这种

3 . 这种方法也会回去到原来的程序里(注意这里的telprompt,因为apple的文档里边没出现过telprompt这个,所以上架可能不被拒),也会弹出提示

原文来至cocoachina论坛,链接: ?

iOS 唤起拨打电话,打电话功能

1.这种方法,网上很多说法是,拨打完,电话。回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示

但本人在iOS 10.3测试是,有 提示框的。也会回到原来的应用。其他版本系统没有测试过。

唤起提示框,很略慢。

这种方法,打完电话后还会回到原来的程序,也会弹出提示

但本人在iOS 10.3测试,唤起提示框,很略慢。

这种方法也会回去到原来的程序里(注意这里的telprompt),也会弹出提示

但本人在iOS 10.3测试,唤起提示框,很略慢。

打完电话后还会回到原来的程序,也会弹出提示

前面的三种方法都会有⚠️,提示ios10后不再推荐使用。

官方,iOS 10之后推荐使用下面的方法

但本人在iOS 10.3测试,唤起提示框,比前面三种方法快。

iOS开发打电话的三种方法

1,这种方法,拨打完电话回不到原来的应用,会停留在通讯录里,而且是直接拨打,不弹出提示

NSMutableString* str=[[NSMutableStringalloc]initWithFormat:@"tel:%@",@"186xxxx6979"];//            NSLog(@"str======%@",str);[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

2,这种方法,打完电话后还会回到原来的程序,也会弹出提示,推荐这种

NSMutableString* str=[[NSMutableStringalloc]initWithFormat:@"tel:%@",@"186xxxx6979"];UIWebView* callWebview = [[UIWebViewalloc]init];

[callWebviewloadRequest:[NSURLRequestrequestWithURL:[NSURLURLWithString:str]]];

[self.viewaddSubview:callWebview];

[callWebviewrelease];

[strrelease];

3,这种方法也会回去到原来的程序里(注意这里的telprompt),也会弹出提示

NSMutableString* str=[[NSMutableStringalloc]initWithFormat:@"telprompt://%@",@"186xxxx6979"];//            NSLog(@"str======%@",str);

[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:str]]

iOS H5嵌套打电话功能实现

在ios中,用H5编写了可以打电话的页面。 点击“拨打”按钮后可以进行跳转到打电话的页面(跳转这一块应该是和浏览器有关),跳转之后拨打完电话能够回到之前打电话的页面。

1.UIWebView

方法1:NSString *location =[webViewstringByEvaluatingJavaScriptFromString:@"document.location"];

方法2:NSLog(@"webView location = '%@'", webView.request.URL.absoluteString);

以上两种一定要放在页面成功加载之后才可以的!

2.WKWebview

#pragma mark 在发送请求之前,决定是否跳转

怎么在ios中调用拨打电话?有没有简单的例子提供

下面是我在网上找到的结果。应该是可以用的。

1、调用 自带mail

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]];

2、调用 电话phone

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://xxxxxxxx"]];

iOS应用内拨打电话结束后返回应用

一般在应用中拨打电话的方式是:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://xxx"]];

使用这种方式拨打电话时,当用户结束通话后,iphone界面会停留在电话界面。

用如下方式,可以使得用户结束通话后自动返回到应用:

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

NSURL *telURL =[NSURL URLWithString:@"tel:10086"];// 貌似tel:// 或者 tel: 都行

[callWebview loadRequest:[NSURLRequest requestWithURL:telURL]];

//记得添加到view上

[self.view addSubview:callWebview];

 还有一种私有方法:(可能不能通过审核)

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"telprompt://10086"]];

3、调用 SMS

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]];

4、调用自带 浏览器 safari

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@""]];

调用phone可以传递号码,调用SMS 只能设定号码,不能初始化SMS内容。

若需要传递内容可以做如下操作:

加入:MessageUI.framework

#import MessageUI/MFMessageComposeViewController.h

实现代理:MFMessageComposeViewControllerDelegate

调用sendSMS函数

//内容,收件人列表

- (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients

{

MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];

if([MFMessageComposeViewController canSendText])

{

controller.body = bodyOfMessage;

controller.recipients = recipients;

controller.messageComposeDelegate = self;

[self presentModalViewController:controller animated:YES];

}

}

// 处理发送完的响应结果

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result

{

[self dismissModalViewControllerAnimated:YES];

if (result == MessageComposeResultCancelled)

NSLog(@"Message cancelled")

else if (result == MessageComposeResultSent)

NSLog(@"Message sent")

else

NSLog(@"Message failed")

}


本文标题:ios开发拨打电话,ios 定时打电话
文章起源:http://scyingshan.cn/article/hosjjs.html