MFMessageComposeViewController not calling its delegate method
Asked Answered
S

1

5

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.

Sarsaparilla answered 8/6, 2012 at 14:48 Comment(0)
T
21

You have to set the mailComposeDelegate

    message.messageComposeDelegate = self;
Topographer answered 8/6, 2012 at 14:50 Comment(4)
Also, Make sure your class conforms to the proper delegate protocol: <MFMessageComposeViewControllerDelegate>Darnall
message.messageComposeDelegate = self;Joyejoyful
Just out of curiosity would anyone happen to know what is the original delegate used for? I assume it is used for something else.Sidoon
@Sidoon the original delegate is the UINavigationDelegateCostermonger

© 2022 - 2024 — McMap. All rights reserved.