我希望能够在我的应用程序中使用 iPhones Mail.app,这样我的用户就可以在不离开应用程序的情况下发送共享电子邮件。我知道 3.0 使这成为可能。
我已经通过 ctrl 单击我的框架文件夹-> 添加现有框架来正确添加框架。
将此添加到我希望 Mail.app 出现的视图控制器的头文件中。
#import <MessageUI/MessageUI.h>
我弹出一个 UIAlert 并在关闭时调用下面的函数,我的代码中没有出现错误。我必须在 Interface Builder 中做一些额外的事情吗?错误消息如下
-(void)showEmailModalView {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; // <- very important step if you want feedbacks on what the user did with your email sheet
NSString * emailSubject = [[NSString alloc] initWithFormat:@"iPhone Subject Test"];
[picker setSubject:emailSubject];
NSString * content = [[NSString alloc] initWithFormat:@"iPhone Email Content"];
// Fill out the email body text
NSString *pageLink = @"http://mugunthkumar.com/mygreatapp"; // replace it with yours
NSString *iTunesLink = @"http://link-to-mygreatapp"; // replate it with yours
NSString *emailBody =
[NSString stringWithFormat:@"%@\n\n<h3>Sent from <a href = '%@'>MyGreatApp</a> on iPhone. <a href = '%@'>Download</a> yours from AppStore now!</h3>", content, pageLink, iTunesLink];
[picker setMessageBody:emailBody isHTML:YES]; // depends. Mostly YES, unless you want to send it as plain text (boring)
picker.navigationBar.barStyle = UIBarStyleBlack; // choose your style, unfortunately, Translucent colors behave quirky.
[self presentModalViewController:picker animated:YES];
[picker release];
[content release];
[emailSubject release];
}
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self dismissModalViewControllerAnimated:YES];
}
我的错误信息:
ld: framework not found Message
collect2: ld returned 1 exit status
我遵循了本教程: http ://blog.mugunthkumar.com/coding/iphone-tutorial-in-app-email/