ios - MFMessageComposeViewController cancel button not working -
i use block send message contacts, after sending, button there, when touch nothing happens. please me out :)
-(ibaction) inviteit:(id) sender{ if ([mfmessagecomposeviewcontroller cansendtext]) { mfmessagecomposeviewcontroller *messagecomposer = [[mfmessagecomposeviewcontroller alloc] init]; messagecomposer.messagecomposedelegate = self; nsstring *message = @"you have more body buddies 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 forget 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 mail interface [controller dismissviewcontrolleranimated:yes completion:nil]; }
from apple documentation:
// mail compose view controller delegate method - (void)mailcomposecontroller:(mfmailcomposeviewcontroller *)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error { [self dismissmodalviewcontrolleranimated:yes]; }
but can handle cases depend on goal ...
Comments
Post a Comment