我有一個應用程序,我建立了一段時間,使用郵件撰寫模塊和工作,但是,一旦我升級到iOS6它停止工作。這是我在我的.h代碼:郵件撰寫模塊停止工作在ios6
#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:@"[email protected]", 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];
}
有誰知道什麼導致它打破?
一個小提示將'tel:'模式更改爲'tel:01748826265',而沒有使用'//'。 iPhone 5可能不理解架構中的「//」。 – rckoenes
[self dismissModalViewControllerAnimated:YES];刪除這個。也許你正在呈現和解散視圖。 –