2013-02-04 11 views
1

我有一個應用程序,我建立了一段時間,使用郵件撰寫模塊和工作,但是,一旦我升級到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]; 
} 

有誰知道什麼導致它打破?

+0

一個小提示將'tel:'模式更改爲'tel:01748826265',而沒有使用'//'。 iPhone 5可能不理解架構中的「//」。 – rckoenes

+1

[self dismissModalViewControllerAnimated:YES];刪除這個。也許你正在呈現和解散視圖。 –

回答

1

嘗試添加此語句。

composer.wantsFullScreenLayout = YES; 
+0

請添加一些說明文字,以使其成爲有用的答案。 –

0

請查看以下鏈接: -

  1. Tutorial
  2. Example

執行此操作後,請不要忘記設置您的帳戶在你的iPhone 5的Settings。請添加您的郵寄帳戶。如果仍然面臨任何問題,這將工作和恢復我。