- (void)sendMessage { if ([MFMessageComposeViewController canSendText]) { MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init]; self.controller = controller; //设定SMS讯息内容 controller.body = [NSString stringWithFormat:@"消息内容"]; //设定接传送对象的号码 controller.recipients = @[18322222222]; controller.messageComposeDelegate = self; [self presentViewController:self.controller animated:YES completion:nil]; } else { NSLog(@"您的手机无法送短信"); } } #pragma mark - MFMessageComposeViewControllerDelegate - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result; { switch (result) { case MessageComposeResultSent: { NSLog(@"讯息传送成功"); } break; case MessageComposeResultFailed: { NSLog(@"讯息传送失败"); } break; case MessageComposeResultCancelled: { NSLog(@"讯息被用户取消传送"); } break; default: break; } [controller dismissViewControllerAnimated:YES completion:nil]; }