我已将 XCode 更新到 4.5,如果我按下按钮发送电子邮件,现在电子邮件功能会崩溃。
我做错了什么?
我已经在我的头文件中实现了 MessageUI.framework
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface ImpressumViewController : UIViewController <MFMailComposeViewControllerDelegate>
这是我的按钮代码:
- (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];
}