0

MFMailComposer を使用しています。メールを gmail に送信すると、MFMailComposer が MFMailComposeResultSent ステータスを返します。しかし、私は電子メールを受け取っていません。4.3.4 の iphone4 でテストしました。私は何を間違っていますか?

MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init];
    mailPicker.mailComposeDelegate = self;

    // Set the subject of email
    [mailPicker setSubject:@"Subject"];
    NSString *emailBody = @"Hello from ios";

    // This is not an HTML formatted email
    [mailPicker setMessageBody:emailBody isHTML:NO];


    [self presentModalViewController:mailPicker animated:YES];

    [mailPicker release];


- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
    if (result == MFMailComposeResultFailed) 
 {
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:[error description] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alertView show];
    [alertView release];
 }
if (result == MFMailComposeResultSent)
 {
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Message has been sent" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alertView show];
    [alertView release];
 }
else
 {
    [self dismissModalViewControllerAnimated:YES];
 }
}

編集:コンソールでこれを見つけました:

DA|Could not open the lock file at /tmp/DAAccountsLoading.lock. We'll load the accounts anyway, but bad things may happen

EDIT2: 4.3.4 の iPhone4 では動作しませんが、4.3 の iPod では問題なく動作します。

4

2 に答える 2

2

あなたは何も悪いことをしていません。Apple の Web サイトから次の行を確認してください。

MFMailComposeResultSent– 電子メール メッセージは、ユーザーの送信トレイでキューに入れられました。ユーザーが次に電子メールに接続したときに送信する準備ができています。

于 2012-10-07T07:29:50.417 に答える
0

指定された場所でメールピッカーを解放しないで[mailPicker release]; ください..自動解放メソッドを使用してみてください

MFMailComposeViewController *mailPicker = [[[MFMailComposeViewController alloc] init]autorelease];

残りは良いです。

于 2011-11-24T12:41:57.300 に答える