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. チュートリアル

Settingsこれを実装したら、iPhone 5 にアカウントを設定することを忘れないでください。メール アカウントを追加してください。それでも問題が発生した場合、これは機能し、私を元に戻します。

于 2013-02-05T13:33:51.840 に答える