我希望能够在我的应用程序中使用iPhones Mail.app,这样我的用户就可以在不离开应用程序的情况下发送共享电子邮件。我知道3.0使这成为可能。iPhone - MessageUI - 找不到框架消息
我已经正确添加框架,通过点击我的框架文件夹 - >添加现有的框架。
已将此添加到ViewController中的头文件我想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/
请参阅http://stackoverflow.com/questions/3352664/how-to-add-existing-frameworks-in-xcode-4 – Stan 2011-12-10 21:18:58