//调用自带mail
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzlzh.com"]]; //调用电话
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://8008808888"]]; //调用sms
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://800888"]]; //调用打开网址
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.baidu.com"]];

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

发短信邮件需要的框架

导入头文件#import <MessageUI/MessageUI.h>

协议:<MFMailComposeViewControllerDelegate,MFMessageComposeViewControllerDelegate>

//点击按钮后,触发这个方法
-(void)sendEMail
{
MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init]; mailPicker.mailComposeDelegate = self; //设置主题
[mailPicker setSubject: @"eMail主题"]; // 添加发送者
NSArray *toRecipients = [NSArray arrayWithObject: @"first@example.com"]; [mailPicker setToRecipients: toRecipients]; // 添加图片
UIImage *addPic = [UIImage imageNamed: @"ios.jpg"];
NSData *imageData = UIImagePNGRepresentation(addPic); // png
// NSData *imageData = UIImageJPEGRepresentation(addPic, 1); // jpeg
[mailPicker addAttachmentData: imageData mimeType: @"" fileName: @"ios.jpg"]; NSString *emailBody = @"eMail 正文";
[mailPicker setMessageBody:emailBody isHTML:YES]; [self presentViewController:mailPicker animated:YES completion:nil];
} - (void)sendSMS{
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init]; if([MFMessageComposeViewController canSendText])
{
controller.body = @"";
controller.recipients = @[@"",@""];
controller.messageComposeDelegate = self; [self presentViewController:controller animated:YES completion:nil];
}
} #pragma mark - <MFMessageComposeViewControllerDelegate> // 处理发送完的响应结果
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil]; if (result == MessageComposeResultCancelled){
NSLog(@"Message cancelled");
} else if (result == MessageComposeResultSent){
NSLog(@"Message sent");
} else{
NSLog(@"Message failed");
}
} #pragma mark - <MFMailComposeViewControllerDelegate> - (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
NSString *msg; switch (result)
{
case MFMailComposeResultCancelled:
msg = @"邮件发送取消";
break;
case MFMailComposeResultSaved:
msg = @"邮件保存成功"; break;
case MFMailComposeResultSent:
msg = @"邮件发送成功"; break;
case MFMailComposeResultFailed:
msg = @"邮件发送失败"; break;
default:
break;
}
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
 

iOS打电话,发短信,发邮件,打开网址的更多相关文章

  1. ios 设置亮度、声音;调用发短信、邮件、打电话

    一,设置亮度 [[UIScreen mainScreen] setBrightness:0.5];//0.0~1.0 二,设置声音 1,添加 MediaPlayer.framework 框架 2,在需 ...

  2. Android实例-打电话、发短信和邮件,取得手机IMEI号(XE8+小米2)

    结果: 1.不提示发短信卡住,点击没有反映,我猜想,可能是因为我用的是小米手机吧. 2.接收短信报错,我猜想可能是我改了里面的方法吧(哪位大神了解,求指教). 3.project -->opti ...

  3. iOS 打电话、发短信、邮件、打开网址、调用应用等合集

    iOS中的很多功能都是非常简单的,几行代码就搞定了,比如打电话.打开网址.发邮件.发短信等,这里总结几个比较常用的: 1.打电话 方式一:最简单最直接的方式:直接跳到拨号界面 NSURL *url = ...

  4. 打电话,发短信,发邮件,app跳转

    1.打电话 - (IBAction)callPhone1:(id)sender { NSURL *url = [NSURL URLWithString:@"tel://18500441739 ...

  5. h5打电话发短信写邮件怎么实现

    // 一.打电话<a href="tel:0755-10086">打电话给:0755-10086</a> // 二.发短信,winphone系统无效< ...

  6. a链接 打电话 发短信 发email

    <a href="tel:10086">给10086打电话</a><a href="sms:10086">给10086发短信 ...

  7. iOS开发——发短信,邮件

    在IOS开发中,有时候我们会需要用到邮件发送的功能.比如,接收用户反馈和程序崩溃通知等等,这个功能是很常用的.在苹果系统中,如果彼此的手机都是iOS设备,并且开通了iMessage功能,那么彼此之间的 ...

  8. ios-王云鹤 调用ios系统功能---------------打电话、发短信、发邮件

    --------------------------------------菜鸟总结,欢迎读者雅正------------------------------------------------- 先 ...

  9. iOS中多种方式实现打电话、发短信、写邮件

    一.打电话 打电话--方法1 NSURL *URL = [NSURL URLWithString:@"tel://10010"]; [[UIApplication sharedAp ...

  10. iOS openURL方法实现打电话、发短信、发邮件、打开其他App

    UIApplication有个功能十分强大的openURL:方法 - (BOOL)openURL:(NSURL*)url; 通过这个方法,我们可以实现: 先获取 UIApplication UIApp ...

随机推荐

  1. GRE协议学习与练习

    通用路由封装(英语:Generic Routing Encapsulation,缩写为GRE),一种隧道协议,可以在虚拟点对点链路中封装多种网络层协议.由思科系统开发 以下是GRE协议的简单练习 网络 ...

  2. Activity(一)

    一个应用程序中至少包含一个Activity,Activity启动流程:当启动一个应用程序时,android操作系统会访问该应用程序的AndroidManifest.xml文件(该文件中说明了应用程序使 ...

  3. SQLserver中idendity的妙用

    假设:现在有产品信息需要入库,要给每个产品按找预定的规则进行编号,编号规则如下: 产品编码:6位产品类型码+1位仓库码+2位年份+5位顺序码(要求从00001开始自增) 6位产品类型码:P00001 ...

  4. PHP(一)

    最近一段时间一直忙于新版本的开发工作,所以虽然自己脑中有一些想法,但是苦于没有足够的时间去写下来.好了,昨天终于将大体的功能开发完成,时间上面也不会那么的紧张了.下来我想要好好的梳理一下,自己最近一段 ...

  5. Hadoop组成

    Hadoop由以下几个子项目组成: Hadoop Common Hadoop体系最底层的一个模块,为Hadoop各子项目提供各种工具,如:配置文件和日志操作等. Avro Avro是doug cutt ...

  6. 002--VS C++ 获取鼠标坐标并显示在窗口上

    //--------------------------------------------MyPaint() 函数------------------------------------------ ...

  7. algorithm之不变序列操作

    概述:不变序列算法,参见http://www.cplusplus.com/reference/algorithm/ /* std::for_each template <class InputI ...

  8. 11.3Daily Scrum

    人员 任务分配完成情况 明天任务分配 王皓南 实现网页上视频上传的功能,研究相关的代码782 数据库测试 申开亮 实现网页上视频浏览的功能.研究相关的代码和功能.783 实现视频浏览的功能 王宇杰 负 ...

  9. .net 常用正则表达式

    Net中正则表达式的简单使用方法及常见验证判断 判断字符串是只是数字我们可以这样写:return new System.Text.RegularExpressions.Regex(@"^([ ...

  10. Careercup - Microsoft面试题 - 5752271719628800

    2014-05-10 20:31 题目链接 原题: Given an array of integers and a length L, find a sub-array of length L su ...