#pragma mark - 调用sendSMS函数
-(void)sendSmsInvite:(NSString*)phone
{
BOOL canSendSMS = [MFMessageComposeViewController canSendText];
NSLog(@"can send SMS [%d]", canSendSMS);
if (canSendSMS) {
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
picker.navigationBar.tintColor = [UIColor blackColor];
picker.body = [NSString stringWithFormat:@"文字描述,快来找我,咱们一起带孩子出去玩吧!"];
// 默认收件人(可多个)
picker.recipients = [NSArray arrayWithObject:phone];
[self presentViewController:picker animated:YES completion:^{
}];
}
}
// 处理发送完的响应结果
- (void)messageComposeViewController :(MFMessageComposeViewController *)controller
didFinishWithResult :( MessageComposeResult)result
{
// Notifies users about errors associated with the interface
switch (result) {
case MessageComposeResultCancelled:
if (DEBUG) NSLog(@"Result: canceled");
break;
case MessageComposeResultSent:
if (DEBUG) NSLog(@"Result: Sent");
break;
case MessageComposeResultFailed:
if (DEBUG) NSLog(@"Result: Failed");
break;
default:
break;
}
[self dismissViewControllerAnimated:YES completion:^{
}];
}