Reputation: 6688
I am attempting to use the autogenerated Swift bridging header in an Objective-C class, but when I try to include it, I get many errors in the bridging header. Since the header is automatically generated, its not at all clear what I might have wrong.
In an Objective-C class, if I declare the following line I will get build errors - without this line, no errors and it builds fine:
#import "Oilist-Swift.h"
EDIT: I just moved the #import "Oilist-Swift.h"
statement to after all the other headers have been imported, and now I only get errors relating to MFMailComposeViewControllerDelegate
and possibly one error relating to PopupStoreControllerDelegate
. Here are all the errors now:
Angle brackets contain both a protocol ('PopupStoreControllerDelegate') and a type ('MFMailComposeViewControllerDelegate')
Unknown class name 'MFMailComposeViewControllerDelegate'; did you mean 'MFMailComposeViewController'?
Replace 'MFMailComposeViewControllerDelegate' with 'MFMailComposeViewController'
- (void)mailComposeController:(MFMailComposeViewController * _Nonnull)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError * _Nullable)error;
Expected a type (MFMailComposeResult)
I've looked for circular references and can't find any so far.
Any insights would be greatly appreciated!
Seems really close now - it seems its just not happy with MFMail for some unknown reason.
Upvotes: 1
Views: 638
Reputation: 6688
If I import MessageUI.h
it works now. (Despite MessageUI not being used at all in the class importing the Swift header).
I guess I have to import MessageUI because it is referenced in the bridging header and doesn't include a definition for the MessageUI stuff...
Solution:
#import <MessageUI/MessageUI.h>
#import "Oilist-Swift.h"
Upvotes: 4