2012-01-04 21 views
0

MessageUIフレームワークを使用してメールを送信していますが、送信時にそのメールを受信しません。MessageUIフレームワークを使用して送信された電子メールを受信して​​いません

私は、コンソールに「メール送信」メッセージが表示されますが、私は私が言ったように私は#import <MessageUI/MessageUI.h>

をインポートしていますし、私は次のコード

- (void)emailFile 
{ 
if(![MFMailComposeViewController canSendMail]) { 
    UIAlertView *cantSend = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Device not configured to send email" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; 
     [cantSend show]; 
    [cantSend release]; 
} else { 
    MFMailComposeViewController *mailView = [[[MFMailComposeViewController alloc] init] autorelease]; 
    mailView.mailComposeDelegate = self; 
    [mailView setToRecipients:[NSArray arrayWithObject:@"[email protected]"]]; 
    [mailView setSubject:@"Test"]; 
    [mailView setMessageBody:@"This is a text message" isHTML:NO]; 
    [self presentModalViewController:mailView animated:YES]; 
} 
} 

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error 
{ 
if(error) { 
    UIAlertView *errorView = [[UIAlertView alloc] initWithTitle:@"Mail Error" message:[error localizedDescription] delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil]; 
    [errorView show]; 
    [errorView release]; 
} else { 
    switch (result) { 
     case MFMailComposeResultSent: 
      NSLog(@"Sent Mail"); 
      break; 
     case MFMailComposeResultSaved: 
      NSLog(@"Mail Saved"); 
      break; 
     case MFMailComposeResultCancelled: 
      NSLog(@"Mail Cancelled"); 
      break; 
     case MFMailComposeResultFailed: 
      NSLog(@"Mail Failed"); 
      break; 
     default: 
      break; 
    } 
} 
[controller dismissModalViewControllerAnimated:YES]; 
} 

を持っています私は送信している電子メールを受け取ることはありません。

私はリンゴの文書を読みましたが、他の誰かが私を助けてくれるものが見つかりませんでした。私は何か間違っているのですか?

+0

使用しているメールの送信メールボックスを確認しましたか? –

答えて

3

デバイスでテストしていることを確認しても、シミュレータ経由で電子メールは送信されません。

+0

私はシミュレータを使用していますが、テスト部門からテスト用の電話を入手する必要があります。おかげさまで大変助かりました。 – Popeye

関連する問題