1. 拨号功能
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];
方法二:
NSMutableString *str = [[NSMutableString alloc] initWithFormat: @"tel:%@", self.phone]; static UIWebView *webView = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ webView = [UIWebView new]; }); [webView loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString: str]]]; [self.view addSubview: webView];
2.发送短信
方法一:
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"sms://10000"]];方法二:
[self showMessageView:[NSArray arrayWithObjects:@"10086", nil] title:@"test" body:@"abc"];
<p class="p1"><span class="s1"><MFMessageComposeViewControllerDelegate> (MessageUI.framework)</span></p>
#import <MessageUI/MessageUI.h>
-(void)showMessageView:(NSArray *)phones title:(NSString *)title body:(NSString *)body { if([MFMessageComposeViewController canSendText]) { MFMessageComposeViewController * controller = [[MFMessageComposeViewController alloc] init]; controller.recipients = phones; controller.navigationBar.tintColor = [UIColor redColor]; controller.body = body; controller.messageComposeDelegate = self; [self presentViewController:controller animated:YES completion:nil]; [[[[controller viewControllers] lastObject] navigationItem] setTitle:title]; //修改短信界面标题 } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示信息" message:@"该设备不支持短信功能" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; [alert show]; } } #pragma mark - MFMessageComposeViewController -(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result { [self dismissViewControllerAnimated:YES completion:nil]; switch (result) { case MessageComposeResultSent: //信息传送成功 break; case MessageComposeResultFailed: //信息传送失败 break; case MessageComposeResultCancelled: //信息被用户取消传送 break; default: break; } }
3.微信发送 <Umeng分享接口>
#import "UMSocial.h"
[UMSocialData defaultData].extConfig.wechatSessionData.title = @"发送微信消息"; [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeText; // UMSocialUrlResource *urlResource = [[UMSocialUrlResource alloc] initWithSnsResourceType:UMSocialUrlResourceTypeImage url:nil]; [[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatSession] content:@"发送微信消息" image:nil location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){ if (response.responseCode == UMSResponseCodeSuccess) { KTLog(@"发送成功!"); } }];