I'm getting values from database and assinging those values to NSMuatbleArray. Then i have sharing array of values into mail. How to share the values with setMessgaeBody:
if (sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK) {
// We "step" through the results - once for each row.
while (sqlite3_step(statement) == SQLITE_ROW) {
sk_code = [[NSString alloc] initWithUTF8String:
(const char *) sqlite3_column_text(statement, 4)];
NSLog(@"sk_code %@",sk_code);
[product_sku_array addObject:sk_code];
// To address
NSArray *toRecipents = [NSArray arrayWithObject:@"test@gmail.com"];
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
// mailController.mailComposeDelegate = self;
[mailController setSubject:@"Test"];
[mailController setMessageBody:product_sku_array isHTML:NO];
[mailController setToRecipients:toRecipents];
[self presentViewController:mailController animated:YES completion:nil];
}
NSLog:
product_sku_array (
123
)
sk_code test1
product_sku_array (
123,
test1
)
temp inside is 123,test1
Initialise your array properly and then use
[mailController setMessageBody:[product_sku_array componentsJoinedByString:@","] isHTML:NO];