少し前に作成したメール作成モジュールを使用して動作するアプリがありますが、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];
}
壊れる原因が何かわかる人いますか?