我正在練習一個示例代碼中的「更多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...");
}
發送郵件是好的,但我還是不能接受它。我錯過了什麼? 發送郵件是好的,但我仍然無法收到它。我錯過了什麼?
哦,這就是原因。謝謝。順便說一句,請問有可能在應用程序中完全發送電子郵件嗎? – user844656
我只使用模擬器,但沒有郵件應用程序。 – user844656
哦!你不能從模擬器發送郵件;-)在真實的設備中測試它! – EmptyStack