我NSMutableArray的数据在NSData的formate.I正在试图连接的NSMutableArray数据到电子邮件body.Here是我的NSMutableArray代码:
NSUserDefaults *defaults1 = [NSUserDefaults standardUserDefaults];
NSString *msg1 = [defaults1 objectForKey:@"key5"];
NSData *colorData = [defaults1 objectForKey:@"key6"];
UIColor *color = [NSKeyedUnarchiver unarchiveObjectWithData:colorData];
NSData *colorData1 = [defaults1 objectForKey:@"key7"];
UIColor *color1 = [NSKeyedUnarchiver unarchiveObjectWithData:colorData1];
NSData *colorData2 = [defaults1 objectForKey:@"key8"];
UIFont *color2 = [NSKeyedUnarchiver unarchiveObjectWithData:colorData2];
CGFloat x =(arc4random()%100)+100;
CGFloat y =(arc4random()%100)+250;
lbl = [[UILabel alloc] initWithFrame:CGRectMake(x, y, 100, 70)];
lbl.userInteractionEnabled=YES;
lbl.text=msg1;
lbl.backgroundColor=color;
lbl.textColor=color1;
lbl.font =color2;
lbl.lineBreakMode = UILineBreakModeWordWrap;
lbl.numberOfLines = 50;
[self.view addSubview:lbl];
[viewArray addObject:lbl ];
viewArray是我的NSMutableArray。所有在viewArray数据存储在NSData的甲酸。那么如何才能连接这个viewArray数据与电子邮件body.here是我的电子邮件代码。
- (IBAction)sendEmail
{
if ([MFMailComposeViewController canSendMail])
{
NSArray *recipients = [NSArray arrayWithObject:@"example@yahoo.com"];
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc]
init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Iphone Game"];
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:viewArray];
NSLog(@"testing: %@", data);
[controller addAttachmentData:data mimeType:@"application/octet-stream";
fileName:nil];
NSString *emailBody = @"Happy Valentine Day!";
[controller setMessageBody:emailBody isHTML:NO
[controller setToRecipients:recipients];
[self presentModalViewController:controller animated:YES];
[controller release];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert"
message:@"Your device is not set up for email."
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
}
}
我没有得到任何错误.viewArray在这里展示这是店,并还当我转换viewArray到NSData的它显示console.but字节不显示在电子邮件body..which是viewArray.please任何一个导向的任何数据对象我怎么可能它连接到我的电子邮件viewArray数据。