IOS 开发调用打电话,发短信
2023-09-11 14:20:31 时间
1、调用 自带mail
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]];
2、调用 电话phone
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]];
iOS应用内拨打电话结束后返回应用
一般在应用中拨打电话的方式是:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://123456789"]];
使用这种方式拨打电话时,当用户结束通话后,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:@"http://www.hzlzh.com"]];
调用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") NSLog(@"Message failed")
[ios开发]-APP-上架流程 由于苹果的机制,在非越狱机器上安装必须通过官方的Appstore, 开发者开发好应用后上传Appstore,也需要通过审核等环节。 AppCan作为一个跨主流平台的一个开发平台,也对ipa包上传Appstore作了支持。 本文从三个流程来介绍如何实现AppCan在 线编译出ipa包,以及上传到苹果Appstore。
//内容,收件人列表 - (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") NSLog(@"Message failed")
[ios开发]-APP-上架流程 由于苹果的机制,在非越狱机器上安装必须通过官方的Appstore, 开发者开发好应用后上传Appstore,也需要通过审核等环节。 AppCan作为一个跨主流平台的一个开发平台,也对ipa包上传Appstore作了支持。 本文从三个流程来介绍如何实现AppCan在 线编译出ipa包,以及上传到苹果Appstore。
相关文章
- iOS实现AVPlayer边加载边播
- IOS开发基础Object-C(12)—单例模式
- 今日头条面试——iOS开发面试题
- 如何在Ubuntu 13.04和13.10上安装iOS 7的图标
- iOS 9应用开发教程之创建iOS 9项目与模拟器介绍
- 《iOS 8开发指南(第2版)》——第1章,第1.7节常用的第三方工具
- 《iOS 6高级开发手册(第4版)》——2.2节秘诀:访问系统粘贴板
- 《iOS 6高级开发手册(第4版)》——2.4节秘诀:展示活动视图控制器
- 基于XCode IOS开发系统实现的新闻APP【100010688】
- iOS initWithFrame、initWithCoder、awakeFromNib的区别解析
- iOS开发 - 如何跳到系统设置里的各种设置界面
- iOS开发—在@interface,@implementation和@property中变量的定义
- iOS 应用开发中的断点续传实践总结
- iOS开发系列--视图切换
- iOS 11之Vision人脸检测
- OS开发小记:iOS富文本框架DTCoreText在UITableView上的使用
- iOS开发笔记--关于 @synchronized,这儿比你想知道的还要多
- 一篇文章详解iOS之AutoResizing、AutoLayout、sizeClass来龙去脉
- iOS开发中添加PrefixHeader.pch要注意的问题
- iOS开发经验总结(上)
- iOS开发之多媒体API
- iOS开发UI篇—ios应用数据存储方式(归档)
- 《Swift iOS应用开发实战》——第3章 设计模式和视图控制器
- iOS开发-SDWebImage的回调不addSubView不会调用
- IOS开发之功能模块--输入框随着键盘的位置移动而移动
- IOS学习资源收集--开发UI控件相关
- iOS开发之网络数据解析(二)--XML解析简介
- iOS frame与bounds区别详解