Iphone 邮件合成界面不';不出现吗?

Iphone 邮件合成界面不';不出现吗?,iphone,ios,Iphone,Ios,我试图复制苹果公司的“发送邮件”代码,但电子邮件合成界面没有出现。。只是一个空白屏幕。我想我做得对。没有对故事板做任何操作,因为没有任何动作或出口。未更改委托的.h或.m文件。下面是代码。非常新的编码。我错过了什么 .h文件 #import <UIKit/UIKit.h> #import <MessageUI/MessageUI.h> @interface ViewController : UIViewController <MFMailComposeViewCo

我试图复制苹果公司的“发送邮件”代码,但电子邮件合成界面没有出现。。只是一个空白屏幕。我想我做得对。没有对故事板做任何操作,因为没有任何动作或出口。未更改委托的.h或.m文件。下面是代码。非常新的编码。我错过了什么

.h文件

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>

@interface ViewController : UIViewController <MFMailComposeViewControllerDelegate>

@end

如果你不介意的话。您正在调用
-(void)displayComposer表
方法的位置


它没有被正确地调用。如果是这样,让我知道你的日志。使用断点

你在哪里调用这个
displayComposer表
?你需要调用你的方法来显示mailcomposer..我想我昨晚太累了。我为DisplayComposer工作表添加了一个iAction,它工作得很好。谢谢。
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController 

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

-(void)displayComposerSheet
{
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"Hello from New Zealand!"];

    // Set up the recipients.
    NSArray *toRecipients = [NSArray arrayWithObjects:@"jfellows123@gmail.com",
                             nil];
    NSArray *ccRecipients = [NSArray arrayWithObjects:@"jfellows123@gmail.com", nil];
    NSArray *bccRecipients = [NSArray arrayWithObjects:@"jfellows123@gmail.com",
                              nil];

    [picker setToRecipients:toRecipients];
    [picker setCcRecipients:ccRecipients];
    [picker setBccRecipients:bccRecipients];

    // Attach an image to the email.
    NSString *path = [[NSBundle mainBundle] pathForResource:@"IMG_3639"
                                                     ofType:@"jpg"];
    NSData *myData = [NSData dataWithContentsOfFile:path];
    [picker addAttachmentData:myData mimeType:@"image/jpg"
                     fileName:@"IMG_3639"];

    // Fill out the email body text.
    NSString *emailBody = @"Beautiful New Zealand!";
    [picker setMessageBody:emailBody isHTML:NO];

    // Present the mail composition interface.
    [self presentViewController:picker animated:YES completion:nil];
}

// The mail compose view controller delegate method
- (void)mailComposeController:(MFMailComposeViewController *)controller
          didFinishWithResult:(MFMailComposeResult)result
                        error:(NSError *)error
{
    [self dismissViewControllerAnimated:YES completion:nil];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end