Search code examples
iphoneobjective-ciosxcodemfmessagecomposeviewcontroller

MFMessageComposeViewController not calling its delegate method


Hi i'm using MFMessageComposeViewController to send sms in my iOS project my code is like below,

 MFMessageComposeViewController *message = [[MFMessageComposeViewController alloc] init];
    message.delegate = self;
    message.recipients = [NSArray arrayWithObject:@"xxxxxx"];
    message.body = @"blha blah,,,,";
    [self presentModalViewController:message animated:YES];

and in my code i'm defining MFMessageComposeViewControllerDelegate method didFinishWithResult but when the task is completed control is not calling this didFinishWithResult delegate method.What may be the problem?

Any help is appreciated in advance.


Solution

  • You have to set the mailComposeDelegate

        message.messageComposeDelegate = self;