iPhone - MessageUI - 找不到框架消息
我希望能够在我的应用程序中使用 iPhone 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 -应用内电子邮件/
I want to be able to use the iPhones Mail.app inside my application so my users can send a share email without leaving the application. I know 3.0 made this possible.
I have added the framework properly by ctrl clicking on my frameworks folder -> add existing framework.
Added this to the header file of the viewcontroller I want the Mail.app to appear in.
#import <MessageUI/MessageUI.h>
I pop up a UIAlert and on closing I call the function below, There are no errors showing up in my code. Do I have to do something extra inside the Interface Builder? Error Msg is Below
-(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];
}
My ERROR MESSAGE:
ld: framework not found Message
collect2: ld returned 1 exit status
I followed this tutorial:
http://blog.mugunthkumar.com/coding/iphone-tutorial-in-app-email/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过一些研究后,我发现我使用的教程非常好!代码没有错误,我的问题是我将 MessageUI Framework 添加到项目的方式。
错误的方式。
按住 Ctrl 键单击框架文件夹并选择添加 ->现有框架..
正确的方式。
在 Xcode 屏幕左侧的文件面板中打开“targets”,双击项目名称。将弹出一个新窗口,在新窗口的底部您可以添加一个新的链接库,通过单击左下角的小加号来添加。向下滚动到 MessageUI 并选择添加。
如果您已经以错误的方式添加了 MessageUI Framework,只需将其删除并按照正确的方式继续即可。如果仍然不起作用,请尝试关闭 xcode,重新启动并重建您的应用程序。
经过几个小时的寻找答案后,这对我有用。
After doing some research I found out that the tutorial I was using was perfectly fine! The code had no errors and my problem was the way I added the MessageUI Framework to my project.
Wrong Way.
Ctrl-click on the frameworks folder and select add -> existing frameworks..
Correct Way.
Open up "targets" in the file panel on the left of your xcode screen, double click your project name. A new window will pop open, at the bottom of the new window you can add a new linked library, add one by clicking the little plus sign in the bottom left hand corner. Scroll down to MessageUI and select Add.
If you had already added the MessageUI Framework the wrong way, just simply delete it and proceed with the correct way. If it still doesn't work try shutting down xcode, restarting, and rebuilding your application.
After many hours of searching for an answer this is what worked for me.
链接器命令行输出将告诉您很多有关 XCode 正在使用什么来尝试构建二进制文件的信息,包括框架包含路径和链接器在构建中包含的框架。从那里您将能够准确地看到 XCode 正在使用什么以及您的设置中可能缺少什么。命令行输出可以在“构建结果”窗口的输出窗格之一中找到。
The linker command line output will tell you a lot about what XCode is using to try and build your binary, including Framework include paths and the frameworks the linker is including in the build. From there you'll be able to see exactly what XCode is using and what might be missing from your settings. The command line output can be found in one of the output panes in the Build Results window.