1

I am working on a project where the code is in Objective-C & Swift 3.2,

I am sending mail from Swift file where I need to extend MFMailViewControllerDelgate

but when I Build project I get an error

Can not find protocol declaration for 'MFMailComposeViewControllerDelegate' at Swift Header file

in below code part

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

To resolve error I edit swift header file & add Manually <MessageUI/MessageUI.h> And everything works fine. but When new changes are made in Project or ad new Swift file this auto-generated file get reset & I get an error again.

please suggest some permanent solution

FYI: In Auto generate file there is @import MessageUI In Build Setting there is MessageUI in Framework In Build Setting Define Modules set to YES ignore target name in the code snippet

Kiran Sarvaiya
  • 1,318
  • 1
  • 13
  • 37
Keval Shah
  • 51
  • 8
  • This looks like an Xcode bug to me. You can try enabling modules in your project, or adding `#import ` to your `.pch` file. Enabling modules is the better fix if it works for you. – Greg Oct 22 '18 at 17:58
  • Thanks for reply, but I coudn't find answer so I did it in Objective C. – Keval Shah Jun 28 '19 at 07:43

0 Answers0