n.evermind
n.evermind

Reputation: 12004

e-Mail controller - how to implement?

I'm trying to call the e-mail programme from my app. What I have done so far:

#import <MessageUI/MessageUI.h>

and added delegate:

@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate>

then I thought I'd be brave and put this into my code:

- (void)sendEmail {


    MFMailComposeViewController *mailComposer;

    mailComposer=[[MFMailComposeViewController alloc] init];
    mailComposer.mailComposeDelegate=self;
    [self presentModalViewController:mailComposer animated:YES];

    [mailComposer release];

}

However, I only get an error message which I do not understand in the slightest. Could anyone please help me to interpret this? It doesn't make any sense to me and doesn't point to a line of code so I don't understand where to start when debugging:

enter image description here

Upvotes: 0

Views: 272

Answers (2)

I think you didn't add framework to your project MessageUI framework.

Upvotes: 1

Louie
Louie

Reputation: 5940

You need to #import the framework in your .m file

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

Upvotes: 2

Related Questions