I am New To Iphone programming.my Array store UIlabel along with properties.For Exp,Text,TextColor,background color etc.Now i want to send all the array data in E-mail body. here is my code.
NSUserDefaults *userDefault=[NSUserDefaults standardUserDefaults];
NSData *myDecodedObject = [userDefault objectForKey: [NSString
stringWithFormat:@"sample"]];
NSArray *arr= [[NSArray alloc] init];
arr= [NSKeyedUnarchiver unarchiveObjectWithData:myDecodedObject];
NSString *string = [arr componentsJoinedByString:@"\n"];
NSString *emailBody = string;
NSLog(@"Testing %@", string);
[mailer setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailer animated:YES];
[mailer release];
My array show all the objects which is store in it and also show bytes.At this time my array contain 5 UIlabel .Now i want to send all these UIlabel in E-mail body.but NSLog i see this.
Testing UILabel: 0x8123760; frame = (135.5 136; 99 30); text = 'Fddddddddddddddsaafgghjkl...'; clipsToBounds = YES; hidden = YES; layer = CALayer: 0x8161590
UILabel: 0x81619b0; frame = (148 323; 69 15); text = 'Xxxxxxxxxxx'; clipsToBounds = YES; layer = CALayer: 0x8161a50
UILabel: 0x8161b70; frame = (140 341; 56 19); text = 'Xxxxxxx'; clipsToBounds = YES; layer = CALayer: 0x81618f0
UILabel: 0x8161d70; frame = (69.5 121.5; 99 145); text = 'Fddddddddddddddsaafgghjkl...'; clipsToBounds = YES; hidden = YES; layer = CALayer: 0x8161e00
UILabel: 0x8161f10; frame = (108 321; 99 145); text = 'Fddddddddddddddsaafgghjkl...'; clipsToBounds = YES; layer = CALayer: 0x8161f80
Not Seen any data in E-mail.so please Suggest What is Best approach to send array data in E-mail.Thanx
useMFmailComposer's addDataAttachements method to add the data from array
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:arr1];
NSLog(@"Testing %@", data);
[controller addAttachmentData:data mimeType:@"application/octet-stream";
fileName:nil]