Skip to content

Instantly share code, notes, and snippets.

@avwave
Created September 25, 2013 11:28
Show Gist options
  • Select an option

  • Save avwave/6698344 to your computer and use it in GitHub Desktop.

Select an option

Save avwave/6698344 to your computer and use it in GitHub Desktop.
-(void)sendSMSToRecipients:(NSArray *)recipientArray SMSString:(NSString *)smsString intoVC:(UIViewController *)vc {
_vc = vc;
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
controller.body = smsString;
controller.recipients = recipientArray;
controller.messageComposeDelegate = self;
[vc presentViewController:controller animated:YES completion:^{
}];
}
}
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
switch (result) {
case MessageComposeResultCancelled:
NSLog(@"Cancelled");
break;
case MessageComposeResultFailed:
break;
case MessageComposeResultSent:
break;
default:
break;
}
[self.vc dismissViewControllerAnimated:YES completion:^{
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment