objective c - Mail function can't send to Recipients in iOS -


i created mail send function xcode.

- (void)onsharebtn:(uibutton *)button {     mfmailcomposeviewcontroller *picker = [[mfmailcomposeviewcontroller alloc] init];     picker.mailcomposedelegate = self;      [picker setsubject:@"hello!"];      // set recipients.     nsarray *torecipients = [nsarray arraywithobjects:@"first@gmail.com",                              nil];     nsarray *ccrecipients = [nsarray arraywithobjects:@"second@gmail.com",                              nil];     nsarray *bccrecipients = [nsarray arraywithobjects:@"third@gmail.com",                               nil];      [picker settorecipients:torecipients];     [picker setccrecipients:ccrecipients];     [picker setbccrecipients:bccrecipients];     [picker setmodaltransitionstyle:uimodaltransitionstylecrossdissolve];      // attach image email.     nsstring *path = [[nsbundle mainbundle] pathforresource:@"share"                                                      oftype:@"png"];     nsdata *mydata = [nsdata datawithcontentsoffile:path];     [picker addattachmentdata:mydata mimetype:@"image/png"                      filename:@"share"];      // fill out email body text.     nsstring *emailbody = @"it raining!";     [picker setmessagebody:emailbody ishtml:no];      // present mail composition interface.     [self presentmodalviewcontroller:picker animated:yes]; }  - (void) mailcomposecontroller:(mfmailcomposeviewcontroller *)controller didfinishwithresult:(mfmailcomposeresult)result error:(nserror *)error {     if(error)     {         uialertview *alert = [[uialertview alloc] initwithtitle:@"error" message:[nsstring stringwithformat:@"error %@",[error description]] delegate:nil cancelbuttontitle:@"dismiss" otherbuttontitles:nil, nil];         [alert show];         [self dismissviewcontrolleranimated:yes completion:null];     }     else     {         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         [self dismissviewcontrolleranimated:yes completion:null];     } } 

this code can show mail form , when clicked send button, cannot send mail recipients properly. function show send mail form. how can update code mail delivered recipients?


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -