我从数据库中获取值,并将这些值分配给NSMutableArray。然后,我将值数组共享到邮件中。如何与设置的消息正文共享值:

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:@"[email protected]"];

 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

最佳答案

正确初始化数组,然后使用

[mailController setMessageBody:[product_sku_array componentsJoinedByString:@“,”] isHTML:NO];

10-07 19:56