2010-03-22 85 views

回答

6

你必須把這個代碼在烏拉圭回合應用,

- (void)mailComposeController:(MFMailComposeViewController*)controller  didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{ 
[self dismissModalViewControllerAnimated:YES]; 
} 

試試這個,它工作正常發送和取消按鈕。

1
MFMailComposeViewController *controller=[[MFMailComposeViewController alloc]init]; 
controller.mailComposeDelegate=self; 

[controller setSubject:@"Important Data"]; 

的html文件,郵件

NSString *path=[[NSBundle mainBundle]pathForResource:@"table" ofType:@"html"]; 
NSFileHandle *readHandle=[NSFileHandle fileHandleForReadingAtPath:path]; 
htmlString = [[NSString alloc] initWithData: [readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding]; 

NSString *emailBody=[NSString stringWithFormat:@"Product Name   %@ \n Company Name  %@ \n Last Updated Date %@ \n desired data \n %@ ",lblProductName.text,lblCompanyName.text,lblUpdateDate.text,htmlString]; 

[controller setMessageBody:emailBody isHTML:YES]; 

[self presentModalViewController:controller animated:YES]; 

[controller release]; 
0

今天,我發現雨燕3.0帶來了新的函數簽名了這個問題。在此之前,mailComposeController甚至沒有被調用,並且郵件(雖然它發送)只是停留在那裏。當我改變到下面時,它工作。

public func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith: MFMailComposeResult, error: Error?) { 

    self.dismiss(animated:true, completion: nil) 


} 
相關問題