iphoneシミュレータのMFMailComposeViewController
から電子メールを送信するテスト方法はありますか?シミュレータでMFMailComposeViewControllerをテストする方法
1
A
答えて
-4
読むSending mail with MFMailComposeViewController
まずMessageUIフレームワークが含まAN MFMailComposeViewControllerDelegateを実装します。
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>
@interface MainViewController : UIViewController <MFMailComposeViewControllerDelegate> {
}
次に、メールコントローラを削除するためのデリゲートメソッドを実装します。
- (IBAction)pressentMailController:(id)sender {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Test subject!"];
// Set up the recipients.
/*NSArray *toRecipients = [NSArray arrayWithObjects:@"[email protected]",
nil];
NSArray *ccRecipients = [NSArray arrayWithObjects:@"[email protected]",
@"[email protected]", nil];
NSArray *bccRecipients = [NSArray arrayWithObjects:@"[email protected]",
nil];
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
*/
// Attach an image to the email.
/*NSString *path = [[NSBundle mainBundle] pathForResource:@"ipodnano"
ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"image/png"
fileName:@"ipodnano"];
*/
// Fill out the email body text.
NSString *emailBody = @"It is raining in sunny California!";
[picker setMessageBody:emailBody isHTML:NO];
// Present the mail composition interface.
[self presentModalViewController:picker animated:YES];
[picker release]; // Can safely release the controller now.
}
// The mail compose view controller delegate method
- (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError *)error
{
[self dismissModalViewControllerAnimated:YES];
}
コードでは、受信者、本文、件名、添付ファイルを追加できます。必要に応じて行のコメントを外します。送信
1
実際のメールは、シミュレータから可能ではありません。 APPを電話機にインストールしてテストします。
しかし、あなたのAPPが行うことができます/制御する/シミュレータで指定することができます。 [送信]ボタンを押した後のすべてがAppleであるため、 が正常に機能しているとみなすことができます。
4
ありませんあなたは我々は次のように限られたものをテストすることができます(私はあなたのメールが配信されないという意味で)...シミュレータ上でそれをテストすることはできません:ビューがものになるかどうか、何をするとき、ユーザーがクリック起こりますキャンセルボタンなど...
メールが配信されたかどうかをテストするには、デバイスを使用する必要があります。あなたの設定には何らかのメール(例:gmail)が設定されている必要があります。
関連する問題
- 1. MFMailComposeViewControllerでToToRecipientsを設定する方法
- 2. iOSシミュレータでiPad Proをテストする方法
- 3. iOS 4.0シミュレータとiOS 5.1でiOSアプリケーションをテストする方法
- 4. シミュレータでさまざまなiOSesをテストする方法
- 5. シミュレータのCFBundleDocumentTypesをテストする
- 6. iOSシミュレータでSMSをテストする
- 7. iOSシミュレータとデバイスでNSFileProtectionCompleteをテストする
- 8. テスト間でiOSシミュレータをリセットする
- 9. ONVIFウェブサービスをテストするためのシミュレータ
- 10. iOS:デバイス対シミュレータのテスト方法が25倍遅い
- 11. MFMailComposeViewControllerは実際にはシミュレータからのsendmailを想定していますか?
- 12. MFMailComposeViewControllerから電子メールアドレスを取得する方法
- 13. MFMailComposeViewController
- 14. xcodeシミュレータでipad 2カメラをテストするIOS 5
- 15. シミュレータではなく物理的なiPhoneでテストするiPhoneアプリケーション
- 16. xcode 4.1のprevios iosバージョンでシミュレータを使用してiphoneアプリをテストする方法
- 17. シミュレータでAppleの支払いをテストできますか
- 18. Xcodeシミュレータで重要な変更をテストできますか?
- 19. iPhoneシミュレータでフェイスアップとフェイスダウンをシミュレートする方法
- 20. iPhoneシミュレータ5.1でデータストレージのパスを取得する方法は?
- 21. 特定のiOSシミュレータでMeteorアプリケーションを起動する方法
- 22. iOSシミュレータ:Macノートパソコンで2本の指をタップする方法は?
- 23. RinSim 4.1.0でシミュレータの時間を取得する方法は?
- 24. シミュレータのデバイスメニューでiphone 4を取得する方法
- 25. iPhoneシミュレータ5.0でpdfをロードして保存する方法
- 26. クライアントのシミュレータで私のアプリケーションをチェックする方法
- 27. iOSシミュレータでパンジェスチャをトリガする方法は?
- 28. デバイス上のMFMailComposeViewControllerを開くことができません。シミュレータで動作します。
- 29. MFMailComposeViewControllerを押すviewController
- 30. CSSとHTMLをMFMailComposeViewControllerで使用する
あなたの答えのためのおかげで、しかし、あなたは違った私の質問を理解し、私は意味:テストする方法MFMailComposeViewControllerが本当に送信ボタンを押した後、電子メールかを送ったかどうか!!?電子メールをチェックアウトしたときに、そのコンポーザーから(シミュレータを使用して)送信された電子メールを見つけることができなかったので、間違った質問に答えることができます。 – JaHelia
-1疑問は、シミュレータでメールコントローラをテストする方法でした。答えは、コードを書く方法を示していますが、メールコントローラがシミュレータで動作しないため、テストを許可しません。 – Lee