1
我已經更新XCode到4.5,現在電子郵件功能崩潰,如果我按下按鈕發送電子郵件。IOS 6 Xcode 4.5 MFMailComposer崩潰
我做錯了什麼?
我已經實現了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 [email protected]"[email protected]";
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];
}
不確定,但嘗試[self presentModalViewController:composer animated:YES completion:nil]; (增加了「Modal」) – Romo
嗨,謝謝你的回答。但這不起作用。我認爲莫代爾是舊版本 – user1355961
完全相同的代碼適用於我 –