2011-07-20 28 views
1

我正在練習一個示例代碼中的「更多iphone 3開發應付iphone SDK 3」,它調用了MailPic。一切安好。沒有錯誤沒有警告。MFMailComposeViewController被實現,但我仍然無法收到郵件

- (IBAction)selectAndMailPic { 
UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; 
if (![UIImagePickerController isSourceTypeAvailable: 
     UIImagePickerControllerSourceTypeCamera]) { 
    sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
} 

UIImagePickerController *picker = 
[[UIImagePickerController alloc] init]; 
picker.delegate = self; 
picker.allowsEditing = YES; 
picker.sourceType = sourceType; 
[self presentModalViewController:picker animated:YES]; 
[picker release]; 

}

- (void)mailImage:(UIImage *)image { 
    if ([MFMailComposeViewController canSendMail]) { 
     MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init]; 
     mailComposer.mailComposeDelegate = self; 
     [mailComposer setSubject:NSLocalizedString(@"Here's a picture...", @"Here's a picture...")]; 
     [mailComposer addAttachmentData:UIImagePNGRepresentation(image) mimeType:@"image/png" fileName:@"image"]; 
     [mailComposer setMessageBody:NSLocalizedString(@"Here's a picture that I took with my iPhone.", @"Here's a picture that I took with my iPhone.") isHTML:NO]; 
     [self presentModalViewController:mailComposer animated:YES]; 
     [mailComposer release]; 
     [image release]; 
    } 
    else 
     message.text = NSLocalizedString(@"Can't send e-mail...", @"Can't send e-mail..."); 
} 

發送郵件是好的,但我還是不能接受它。我錯過了什麼? 發送郵件是好的,但我仍然無法收到它。我錯過了什麼?

回答

1

MFMailComposeViewController實際上並未發送郵件。它只是在郵件應用程序的發件箱排隊郵件,沒有更多。您檢查郵件應用程序的發件箱並查看郵件是否實際發送。

手機中的互聯網連接可能存在問題。在最壞的情況下,重新發送郵件從郵件應用程序的發件箱可能會幫助你!

+0

哦,這就是原因。謝謝。順便說一句,請問有可能在應用程序中完全發送電子郵件嗎? – user844656

+0

我只使用模擬器,但沒有郵件應用程序。 – user844656

+0

哦!你不能從模擬器發送郵件;-)在真實的設備中測試它! – EmptyStack

0

MFMailComposer僅用於發送不接收郵件的郵件。您需要閱讀MFMailComposer的課程參考。

+0

謝謝你告訴我。 – user844656

0

這個應用程序是在iPhone或實時設備不工作在模擬器上的工作。

+0

是的,我現在明白了,謝謝 – user844656

相關問題