I use this block to send message to the contacts, after sending, the back button is there, but when I touch it nothing happens. Please help me out :)
-(IBAction) InviteIt:(id) sender{
if ([MFMessageComposeViewController canSendText]) {
MFMessageComposeViewController *messageComposer =
[[MFMessageComposeViewController alloc] init];
messageComposer.messageComposeDelegate = self;
NSString *message = @"You have more body buddies than you think at: http://www.itunes.com/app/JoyChain ";
[messageComposer setBody:message];
messageComposer.recipients = [NSArray arrayWithObjects:_itsnum, nil];
messageComposer.messageComposeDelegate = self;
[self presentViewController:messageComposer animated:YES completion:nil];
}
}
Did you forget to implement mailComposeController:didFinishWithResult:
?...
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved");
break;
case MFMailComposeResultSent:
NSLog(@"Mail sent");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail sent failure: %@", [error localizedDescription]);
break;
default:
break;
}
// Close the Mail Interface
[controller dismissViewControllerAnimated:YES completion:nil];
}
From apple documentation:
// The mail compose view controller delegate method
- (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
[self dismissModalViewControllerAnimated:YES];
}
But you can handle all cases depend on your goal ...