MFMailComposer - 作品在模拟器,但不是在iPhone 2G

问题描述:

我想添加MFMailComposer到我的iPhone应用程序,并没有太多的运气得到它在我的iPhone 2G启动。它总是将电子邮件应用程序启动到帐户页面并关闭我的应用程序。像模拟器中的魅力一样工作。MFMailComposer - 作品在模拟器,但不是在iPhone 2G

- (void)viewWillAppear:(BOOL)animated {super viewWillAppear:animated];

[self displayComposerSheet]; 

} - (无效)displayComposerSheet {

Class mailClass = (NSClassFromString(@"MFMailComposeViewController")); 
if (mailClass != nil) 
{ 
    // you have the MFMailComposeViewController class 
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; 
picker.mailComposeDelegate = self; 

NSArray *mailArr = [[NSArray alloc] initWithObjects:self.sendTo,nil];  

[picker setSubject:@"Hello from iCamp America"]; 
[picker setToRecipients:mailArr]; 
NSString *emailBody = @"\n\n\email created with iCamp America\nwww.iCampAmerica.com"; 
[picker setMessageBody:emailBody isHTML:NO]; 

[self presentModalViewController:picker animated:YES]; 
[picker release]; 
[mailArr release]; 
} 
else 
{ 
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"You cannot send an email !" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alert show]; 
    [alert release]; 
} 

}

的MFMailComposeViewController仅适用于iPhone OS> 3.0可用。你在开发手机上运行该版本吗?

+0

是 - 在模拟器中运行3.1并在我的iPhone中 – user160462 2009-09-23 14:09:05

愚蠢的我 - 我发现,我已经冲突的通话,发送电子邮件 - 我打电话两者的mailto:URL和MFMailComposer方法具有相同的动作触发.....