[iOS]iOS发送短信
来源:互联网 发布:百度人工智能概念股 编辑:程序博客网 时间:2024/06/01 07:39
1.问题说明
iOS开发中,常用到调用发送短信的功能,下面就是简要说明如何使用系统的短信API
2.问题解决
引入框架
//短信分享#import <MessageUI/MessageUI.h>
绑定委托@interface ViewController ()<MFMessageComposeViewControllerDelegate>
#pragma makr - MFMessageComposeViewControllerDelegate 短信-(void)showSMSPicker:(id)sender{ Class messageClass = (NSClassFromString(@"MFMessageComposeViewController")); if (messageClass != nil) { // Check whether the current device is configured for sending SMS messages if ([messageClass canSendText]) { MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init]; picker.messageComposeDelegate =self; NSString *smsBody =@"这里填写您的短信内容" ; picker.body=smsBody; [self presentViewController:picker animated:YES completion:^{ }]; } else { showAlert(@"温馨提示", @"当前设备不支持短信功能!"); } } else { showAlert(@"温馨提示", @"当前版本不支持短信功能!"); }}- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{ [controller dismissViewControllerAnimated:YES completion:^{ }]; if (result==MessageComposeResultSent) { showAlert(@"恭喜", @"发送成功!"); }else if (result==MessageComposeResultFailed) { showAlert(@"额", @"发送失败了"); }else if (result==MessageComposeResultCancelled) { showAlert(@"恩", @"您取消了发送!"); }}
0 0
- [iOS]iOS发送短信
- iOS发送短信
- iOS发送短信
- IOS 发送短信实现
- ios发送短信功能
- iOS写短信发送
- IOS开发 短信发送
- IOS发送短信附件
- ios app内发送短信
- IOS程序中发送短信
- ios 发送邮件和短信
- iOS App内发送短信
- iOS开发之发送短信
- iOS 定时器(发送短信验证)
- iOS 拨打电话 发送短信
- iOS发送邮件和短信
- [iOS-GQiang]iOS app内发送短信
- iOS 发送短信 和 发送邮件方法
- ios layout机制相关方法
- CodeForces 3C---Tic-tac-toe--思维题
- Elasticsearch初始化配置
- SAP ABAP:获取汇率的完整实现之一
- linux下查看光驱信息
- [iOS]iOS发送短信
- Power of Two
- JSTL(JSP Standard Tag Library,JSP标准标签库)
- caffe layer层详解
- 设计模式
- SDWebImage使用,图片加载和缓存
- cocos2d-x新手引导的实现
- 简单的生成Plist文件
- MyEclipse6.5注册机