私NSMutableArrayのデータはNSDataのformate.Iであるbody.Hereは私NSMutableArrayのコードでEメールに添付NSMutableArrayのデータにしようとしています:電子メール本文に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はviewArrayで私NSMutableArrayの。すべてのデータストアであるNSDataのですformate。その後どのようにこのビューの配列データを添付することができます。電子メールbody.hereは私の電子メールコードです。私はエラーがここに店であり、また、私はNSDataのにviewArrayを変換するとき、それはconsole.butでバイトを示しているbody..which Eメールのいずれかのデータを表示していないオブジェクトを示していない.viewArray取得
- (IBAction)sendEmail
{
if ([MFMailComposeViewController canSendMail])
{
NSArray *recipients = [NSArray arrayWithObject:@"[email protected]"];
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.please任意の1つのガイドどのように電子メールで私のviewArrayデータを添付することができます。 addAttachmentData:mimeType:fileName:
ためMFMailComposeViewController referenceから
Thanx @ sergio.butまだ私の配列データは電子メールで見られませんでした。 – jamil
Strange ...私は適切なファイル名でコードを試してみましたが、color/color1/color2を自分で初期化する必要はありません(私はユーザーデフォルトを設定していません)ので、動作し、メール本文(配列データ、添付ファイルではありません)...あなたは何を見たいですか? – sergio