+ (void)alert:(NSString *)msg{ UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:msg message:@"" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] autorelease]; [alertView showWithBackground];}+ (NSString*) cleanPhoneNumber:(NSString*)phoneNumber{ NSString* number = [NSString stringWithString:phoneNumber]; NSString* number1 = [[[number stringByReplacingOccurrencesOfString:@" " withString:@""] // stringByReplacingOccurrencesOfString:@"-" withString:@""] stringByReplacingOccurrencesOfString:@"(" withString:@""] stringByReplacingOccurrencesOfString:@")" withString:@""]; return number1; }+ (void) makeCall:(NSString *)phoneNumber{ if ([DeviceDetection isIPodTouch]){ [UIUtils alert:kCallNotSupportOnIPod]; return; } NSString* numberAfterClear = [UIUtils cleanPhoneNumber:phoneNumber]; NSURL *phoneNumberURL = [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@", numberAfterClear]]; NSLog(@"make call, URL=%@", phoneNumberURL); [[UIApplication sharedApplication] openURL:phoneNumberURL]; }+ (void) sendSms:(NSString *)phoneNumber{ if ([DeviceDetection isIPodTouch]){ [UIUtils alert:kSmsNotSupportOnIPod]; return; } NSString* numberAfterClear = [UIUtils cleanPhoneNumber:phoneNumber]; NSURL *phoneNumberURL = [NSURL URLWithString:[NSString stringWithFormat:@"sms:%@", numberAfterClear]]; NSLog(@"send sms, URL=%@", phoneNumberURL); [[UIApplication sharedApplication] openURL:phoneNumberURL]; }+ (void) sendEmail:(NSString *)phoneNumber{ NSURL *phoneNumberURL = [NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@", phoneNumber]]; NSLog(@"send sms, URL=%@", phoneNumberURL); [[UIApplication sharedApplication] openURL:phoneNumberURL]; }+ (void) sendEmail:(NSString *)to cc:(NSString*)cc subject:(NSString*)subject body:(NSString*)body{ NSString* str = [NSString stringWithFormat:@"mailto:%@?cc=%@&subject=%@&body=%@", to, cc, subject, body]; str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; }?
详细解决方案
iphone发送短信/邮件/通电话
热度:106 发布时间:2016-04-25 06:30:19.0
相关解决方案
- iphone 模拟器,该如何处理
- 有哪位高手用过JPlayer ,进来一下,IPHONE 等设备播放有关问题
- 单个人去做手机开发选什么平台好?android,iphone?解决办法
- 对于手机android iphone ipad 在线播放视频,服务器需要哪些要求呢?该怎么解决
- >>> PayPal mobile for Android / iPhone 开发包 开放啦!
- iphone + html5是个美模式
- ipad 和 iphone 上的有关问题
- iPhone 筹建PHP版Push服务器 实例操作
- iphone 获取UIWebView内Html步骤
- iPhone Android Web开发(要略)
- 一九七零年// iPhone “变砖”后可继续正常使用的解决方案
- 怎么禁止 iPhone Safari video标签视频自动全屏
- iPhone 六的自适应布局
- 腾挪端实现 iphone android 小图标 文字排版
- iPhone:动态获取UILabel的高度跟宽度
- 有人模仿小弟我的脸、有人模仿小弟我的面,iPhone 6的假面舞会
- iPhone @2x与@3x的图片加载有关问题
- iPhone 6 / 6 Plus 出现后,怎么改进工作流以实现一份设计稿支持多个尺寸
- jQuery 判断iPad、iPhone、Android是横屏仍是竖屏
- 检测香港特别行政区 iPhone 6 库存信息
- iPhone、iPad挟制关机
- iPhone How-to:怎么清除控件的Target-Action
- 为啥 iPhone 的拍照效果比其它手机优秀
- iPhone 跟 Galaxy快速拍照原理详细分析
- 5个方法,将 storyboard 从 iphone 版转变为 ipad 版
- iPhone 六是否比以前的iPhone更加帅
- iphone 获取手机现阶段内存大小
- Hacking EV3系列之7:iPhone 手势无线控制LEGO EV3 Gyro Boy 机器人
- iphone 开发 有外设 蓝牙设备,该怎么处理
- jQuery 判断iPad、iPhone、Android是横屏仍是竖屏(window.orientation实现)