自动生成-Swift文件无法添加<messageui messageui.h =“”>框架

时间:2018-03-22 10:01:47

标签: ios objective-c swift email objective-c-swift-bridge

我正在开发一个项目,其代码在Objective-C&amp; Swift 3.2,

我从Swift文件发送邮件,我需要扩展MFMailViewControllerDelgate

但是当我构建项目时出现错误

  

无法找到&#39; MFMailComposeViewControllerDelegate&#39;的协议声明   在Swift Header文件

在下面的代码部分

@interface EmailManager (SWIFT_EXTENSION("targetname")) 
   <MFMailComposeViewControllerDelegate>
   - (void)mailComposeController:(MFMailComposeViewController * 
   _Nonnull)controller didFinishWithResult:(MFMailComposeResult)result 
   error:(NSError * _Nullable)error;
@end

解决错误我编辑swift头文件&amp;手动添加<MessageUI/MessageUI.h> 一切正常。 但是当在Project或ad new Swift文件中进行新的更改时,这个自动生成的文件会被重置&amp;我再次收到错误。

请提出一些永久解决方案

供参考: 在自动生成文件中有@import MessageUI 在Build Setting中,Framework中有MessageUI 在构建设置中定义模块设置为YES 忽略代码段中的目标名称

0 个答案:

没有答案