1

我有一个我前段时间构建的应用程序,它使用邮件撰写模块并且可以工作,但是,一旦我升级到 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];
}

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

4

2 回答 2

1

尝试添加此语句。

composer.wantsFullScreenLayout = YES;
于 2013-02-04T12:45:24.817 回答
0

请检查以下链接:-

  1. 教程
  2. 例子

执行此操作后,请不要忘记在SettingsiPhone 5 中设置您的帐户。请添加您的邮件帐户。如果仍然遇到任何问题,这将起作用并使我恢复原状。

于 2013-02-05T13:33:51.840 回答