首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iPhone - MessageUI -找不到框架消息

iPhone - MessageUI -找不到框架消息
EN

Stack Overflow用户
提问于 2009-09-04 02:42:44
回答 2查看 10.8K关注 0票数 8

我希望能够在我的应用程序中使用iPhones Mail.app,这样我的用户就可以在不离开应用程序的情况下发送共享电子邮件。我知道3.0让这一切成为可能。

我已经通过ctrl键点击my frameworks文件夹-> add existing framework正确地添加了框架。

将其添加到我想要显示Mail.app的视图控制器的头文件中。

代码语言:javascript
复制
#import <MessageUI/MessageUI.h>

我弹出一个UIAlert,并在关闭时调用下面的函数,代码中没有显示错误。我必须在接口生成器中做一些额外的事情吗?错误消息在下面

代码语言:javascript
复制
-(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];
}

我的错误消息:

代码语言:javascript
复制
 ld: framework not found Message
 collect2: ld returned 1 exit status

我遵循了这个教程:http://blog.mugunthkumar.com/coding/iphone-tutorial-in-app-email/

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2009-09-04 03:30:50

在做了一些研究之后,我发现我正在使用的教程是完全正确的!代码没有错误,我的问题是我将MessageUI框架添加到项目中的方式。

错误的方式。按住Ctrl键并单击文件夹,然后选择add -> existing frameworks..

打开“目标”在屏幕左侧的文件面板中,双击你的项目名称。将弹出一个新窗口,在新窗口的底部,您可以添加一个新的链接库,通过单击左下角的小加号添加一个。向下滚动到MessageUI并选择Add。

如果您已经以错误的方式添加了MessageUI框架,只需将其删除并以正确的方式继续操作即可。如果仍然不起作用,请尝试关闭xcode,重新启动并重新构建应用程序。

在花了很多小时寻找答案之后,这就是我想要的。

票数 18
EN

Stack Overflow用户

发布于 2009-09-04 03:27:38

链接器命令行输出将告诉您许多有关XCode正在尝试构建二进制文件的信息,包括框架包含路径和链接器包含在构建中的框架。从那里,您将能够确切地看到XCode正在使用什么,以及您的设置中可能缺少的内容。可以在“生成结果”窗口的其中一个“输出”窗格中找到命令行输出。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1376977

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档