将NSMutableArray打印到电子邮件正文

0 arrays nsmutablearray ios

我是iOS开发的新手,我正在开发我的第一个应用程序.我有一段代码,假设我在分享时将数据从我的NSMutableArray添加到电子邮件正文中.我遇到了一个问题,数组描述只打印出数据的地址而不是实际的数据.我知道这是一种预期的行为,我如何在电子邮件正文中显示数组的内容?

这是我写的代码:

- (void)displayMailComposerSheet
{

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"Attendance"]; 

    NSString *data = [self.attendItems description];

    [picker setMessageBody:data isHTML:NO];

    [self presentViewController:picker animated:YES completion:NULL];
}
Run Code Online (Sandbox Code Playgroud)

Ano*_*dya 6

代替

NSString *data = [self.attendItems description];
Run Code Online (Sandbox Code Playgroud)

使用类似的东西:

NSString *data = [self.attendItems componentsJoinedByString:@", "];
Run Code Online (Sandbox Code Playgroud)

数组中的所有值都将以逗号(,)连接.