我正在尝试获取应用内电子邮件工作的基本示例,并获得似乎与 MessageUI 框架相关的链接器错误。在我的 .h 文件中,我有
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
@interface ButtonViewController : UIViewController
<MFMailComposeViewControllerDelegate>
{
MFMailComposeViewController *mailComposer;
}
在我的 .m 文件中,我使用该 mailComposer 对象。我分配初始化并设置它,没有编译器错误。
mailComposer =[[MFMailComposeViewController alloc] init];
mailComposer.mailComposeDelegate = self;
[mailComposer setSubject:@"Test mail"];
[mailComposer setMessageBody:@"Testing Message Body" isHTML:NO];
[self presentViewController:mailComposer animated:YES completion:nil];
但我确实得到了链接器错误。我想我错过了一些我需要预先做的事情。
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
objc-class-ref in ButtonViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(null): "_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
(null): Objc-class-ref in ButtonViewController.o
(null): Symbol(s) not found for architecture i386
(null): Linker command failed with exit code 1 (use -v to see invocation)
谢谢你。月桂树