我想添加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];
}
}
是 - 在模擬器中運行3.1並在我的iPhone中 – user160462 2009-09-23 14:09:05