【发布时间】:2009-09-22 12:15:16
【问题描述】:
我正在尝试将 MFMailComposer 添加到我的 iPhone 应用程序中,但在我的 iPhone 2G 中启动它并不顺利。它总是将电子邮件应用程序启动到帐户页面并关闭我的应用程序。在模拟器中像魅力一样工作。
-(void)viewWillAppear:(BOOL)动画 { [超级viewWillAppear:动画];
[self displayComposerSheet];
} -(void)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];
}
}
【问题讨论】:
标签: iphone