NSString *telNumberStr = @"020-12345678";
NSString *telString = [[NSString alloc] initWithFormat:@"tel:%@",telNumberStr];
NSString *telString = [[NSString alloc] initWithFormat:@"telprompt://%@",telNumberStr];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telString]];
NSString *url = @"sms://10086";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
1、导入框架:
#import <MessageUI/MessageUI.h>
2、遵循协议:
<MFMessageComposeViewControllerDelegate>
3、代码调用实现:
MFMessageComposeViewController *msgVC =[[MFMessageComposeViewController alloc] init];
msgVC.body = @"一起玩耍吧";
msgVC.recipients = @[@"10086", @"10010"];
msgVC.messageComposeDelegate = self;
[self presentViewController:msgVC animated:YES completion:nil];
4、代理回调
#pragma mark - MFMessageComposeViewControllerDelegate
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{
[controller dismissViewControllerAnimated:YES completion:nil];
if (result == MessageComposeResultCancelled) {
NSLog(@"点击右上角、取消按钮");
}
if (result == MessageComposeResultSent) {
NSLog(@"短信发送");
}
if (result == MessageComposeResultFailed) {
NSLog(@"发送失败");
}
}
NSString *url = @"http://www.baidu.com";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
NSString *appId = @"";
NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/us/app/id%@",appId];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
NSString *appId = @"";
NSString *url = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software&id=%@",appId];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];