Mail Compose模块在ios6中停止工作

时间:2013-02-04 12:40:32

标签: iphone xcode sdk ios6

我有一个我之前构建的应用程序,它使用邮件撰写模块并且工作,但是,一旦我升级到iOS6它就停止了工作。这是我的.h中的代码:

#import <UIKit/UIKit.h>
#import <MessageUi/MFMailComposeViewController.h>

@interface SecondViewController : UIViewController <MFMailComposeViewControllerDelegate>

-(IBAction)email;

@end

这是我的.m代码:

#import "SecondViewController.h"

@implementation SecondViewController

-(IBAction)telephone2 {

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://01748826265"]];
}

-(IBAction)email {
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
    [composer setToRecipients:[NSArray arrayWithObjects:@"info@pizzaprontorichmond.co.uk", nil]];
    [composer setSubject:@"subject here"];
    [composer setMessageBody:@"message here" isHTML:NO];
    [composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [self presentModalViewController:composer animated:YES];
}
[self dismissModalViewControllerAnimated:YES];
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
if (error) {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"error" message:[NSString stringWithFormat:@"error %@", [error description]] delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil];
    [alert show];

}
[self dismissModalViewControllerAnimated:YES];
}

有谁知道是什么导致它破裂?

2 个答案:

答案 0 :(得分:1)

尝试添加此声明。

composer.wantsFullScreenLayout = YES;

答案 1 :(得分:0)

请查看以下链接: -

  1. Tutorial
  2. Example
  3. 执行此操作后,请不要忘记在iPhone的Settings设置帐户.5。添加您的邮寄帐户。如果仍然遇到任何问题,这将有效并且还原我。