IOS 开发,调用打电话,发短信,打开网址

 

1、调用 自带mail

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

2、调用 电话phone

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

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")  
  else 
    NSLog(@"Message failed")  
}

发送邮件的为:

导入#import <MessageUI/MFMailComposeViewController.h>

实现代理:MFMailComposeViewControllerDelegate

//发送邮件

-(void)sendMail:(NSString *)subject content:(NSString *)content{

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

if([MFMailComposeViewController canSendMail])

{

[controller setSubject:subject];

[controller setMessageBody:content isHTML:NO];

controller.mailComposeDelegate = self;

[self presentModalViewController:controller animated:YES];

}

}

//邮件完成处理

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{

[self dismissModalViewControllerAnimated:YES];

if (result == MessageComposeResultCancelled)

NSLog(@"Message cancelled");

else if (result == MessageComposeResultSent)

NSLog(@"Message sent");

else

NSLog(@"Message failed");

}

IOS 开发,调用打电话,发短信,打开网址的更多相关文章

  1. iOS开发中打电话发短信等功能的实现

    在APP开发中,可能会涉及到打电话.发短信.发邮件等功能.比如说,通常一个产品的"关于"页面,会有开发者的联系方式,理想情况下,当用户点击该电话号码时,能够自动的帮用户拨出去,就涉 ...

  2. html5开发手机打电话发短信功能

    原文:http://www.open-open.com/code/view/1449843459332 在很多的手机网站上,有打电话和发短信的功能,对于这些功能是如何实现的呢.其实不难,今天我们就用h ...

  3. html5开发手机打电话发短信功能,html5的高级开发,html5开发大全,html手机电话短信功能具体解释

    在非常多的手机站点上,有打电话和发短信的功能,对于这些功能是怎样实现的呢.事实上不难,今天我们就用html5来实现他们. 简单的让你大开眼界.HTML5 非常easy写,但创建网页时,您常常须要反复做 ...

  4. 向android模拟器打电话发短信的简单方法

    在开发android应用程序时,有时候需要测试一下向android手机拨打电话发送短信时该应用程序的反应.譬如编写一个广播接收器,来提示用户有短信收到或者处理短信,就需要向该手机发送短信来进行测试.这 ...

  5. iOS开发之调用系统打电话发短信接口以及程序内发短信

    在本篇博客开头呢,先说一下写本篇的博客的原因吧.目前在做一个小项目,要用到在本应用程序内发验证码给其他用户,怎么在应用内发送短信的具体细节想不大起来了,于是就百度了一下,发现也有关于这方面的博客,点进 ...

  6. AJ学IOS(45)之常用的小功能比如打电话、打开网址、发邮件、发短信打开其他应用。

    AJ分享,必须精品 简介 iOS中的很多小功能都是非常简单的,几行代码就搞定了,比如打电话.打开网址.发邮件.发短信.打开其他应用等. 打电话 方法1 最简单最直接的方式:直接跳到拨号界面 NSURL ...

  7. ios 调用系统发短信以及打电话功能

    先介绍一种最简单的方法: 调用打电话功能 [[UIApplicationsharedApplication] openURL:[NSURL URLWithString:@"tel://100 ...

  8. iOS - 打电话, 发短信

    电话.短信是手机的基础功能,iOS中提供了接口,让我们调用.这篇文章简单的介绍一下iOS的打电话.发短信在程序中怎么调用. 1.打电话 [[UIApplication sharedApplicatio ...

  9. ios打电话发短信接口

    电话.短信是手机的基础功能,iOS中提供了接口,让我们调用.这篇文章简单的介绍一下iOS的打电话.发短信在程序中怎么调用. 1.打电话 [[UIApplication sharedApplicatio ...

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

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

随机推荐

  1. C语言 homework (3)

      #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { ; char c; do{ ...

  2. 粒子系统模块(Particle System Modules40)

    粒子系统模块(Particle System Modules40) 粒子系统模块(忍者飞镖) 粒子系统(忍者飞镖)(Particle System (Shuriken)) 用模块描述粒子一段时间内的行 ...

  3. Linux环境变量的添加设置

    以前一直都记着的,后来做的事情多了就什么都忘的差不多了. 在Linux中,环境变量一般添加有这么几个地方: 1./etc/profile 这个目录设置的变量为整个系统的全局变量,所有的用户通用,一般不 ...

  4. Bloom Filter 概念和原理

    Bloom filter 是由 Howard Bloom 在 1970 年提出的二进制向量数据结构,它具有很好的空间和时间效率,被用来检测一个元素是不是集合中的一个成员.如果检测结果为是,该元素不一定 ...

  5. 常用浏览器user_agent大全

    PC端: safari 5.1 – MACUser-Agent:Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit ...

  6. xadmin 自定义视图在uwsgi部署时的一坑

    比如修改登录页的template,代码如下: xadmin.site.register(xadmin.views.LoginView, login_template="card_pool/s ...

  7. Python连接MySQL的准备工作

    首先要安装MySQL,64位的win7可以安装64或者32位的MySQL版本,安装之后,python需要一个工具才能连接MySQL,这个工具叫MySQL-python,去这里或者这里下载1.2.3版本 ...

  8. 【GoLang】转载:我为什么放弃Go语言,哈哈

    我为什么放弃Go语言 作者:庄晓立(Liigo) 日期:2014年3月 原创链接:http://blog.csdn.NET/liigo/article/details/23699459 转载请注明出处 ...

  9. 一个静态的HTML页面用jquery ajax登录到sharepoint页面

       $.ajax({             type: "get",              url: "http://",              d ...

  10. centos7.0 安装LNMP运行环境

    LNMP作为php流行的运行环境,而最近需要搭建一个内部的php论坛.记录下LNMP的安装: 1.安装mysql 请参考:centos7 安装mysql5.7.11注意事项 2.安装php yum i ...