I have updated XCode to 4.5 and now the Email Function crashes, if I press the button to send an email.
What I am doing wrong?
I have implemented the MessageUI.framework in my header file
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface ImpressumViewController : UIViewController <MFMailComposeViewControllerDelegate>
Here is my code for the button:
- (IBAction)kontakt:(id)sender {
MFMailComposeViewController *mailcontroller = [[MFMailComposeViewController alloc] init];
[mailcontroller setMailComposeDelegate:self];
NSString *email =@"Youtube@gmail.com";
NSArray *emailArray = [[NSArray alloc] initWithObjects:email, nil];
[mailcontroller setToRecipients:emailArray];
[mailcontroller setSubject:@"Youtube Tutorials"];
[self presentViewController:mailcontroller animated:YES completion:nil]; }
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
[self dismissViewControllerAnimated:YES completion:nil];
}