Reputation: 1
I am new to iOS development and i am working on my first app. I have a piece of code that is suppose to add data from my NSMutableArray to the body of an email when i share it. I ran into an issue where the array description just prints out the address of the data and not the actual data. I understand that this is an expected behavior, how can i display contents of the array in the email body?
Here is the code I wrote:
- (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];
}
Upvotes: 0
Views: 80
Reputation: 46543
Instead of
NSString *data = [self.attendItems description];
Use something like:
NSString *data = [self.attendItems componentsJoinedByString:@", "];
All the values in the array will be joined by a comma (,).
Upvotes: 6