Hello all and thanks for your time. I believe I have a simple question.
I am trying to strip the string email body of it’s quote marks (they seem to come from getting the getting my body from a dictionary) and pass it to MailObject….with no luck I keep getting SIGBRT on my *finalString line.
What am I missing. Thanks again for any help.
NSMutableDictionary *my_data = [myMasterOrderList objectAtIndex:[self.tableView indexPathForCell:cell].row];
NSMutableArray *toEmail = [[NSMutableArray alloc] init];
[toEmail addObject:[my_data objectForKey:@"repemail"]];
NSMutableString *toBody = [my_data objectForKey:@"myOrder"];
// [toBody addObject:[my_data objectForKey:@"myOrder"]];
// NSString *finalSting = [[NSString alloc] init];
NSMutableString *finalString = [NSMutableString stringWithFormat:@"%@",[toBody stringByReplacingOccurrencesOfString:@"\"" withString:@"%20"]];
NSLog(@" toBody my_data%@", finalString);
//************* SEND MAIL *************
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setToRecipients:toEmail];
[mailViewController setSubject:@"Sub Goes Here."];
[mailViewController setMessageBody:finalString isHTML:NO];
[self presentModalViewController:mailViewController animated:YES];
I tested this code:
The output of the NSLog is:
I actually copied your code to use. I know it sounds basic, but since mine worked, have you tried restarting Xcode and/or rebooting your machine, cleaning your project, etc…?