Use the composer's mailComposeDelegate property: composer.messageComposeDelegate = self;
It's because that name was already taken by an unrelated delegate declared in the superclass. (UINavigationController declares a delegate property.)
문제
I can't understand why I must declare conformity to both MFMessageComposeViewControllerDelegate
and UINavigationControllerDelegate
when using MFMessageComposeViewController
.
Failure to simply declare conformity to UINavigationControllerDelegate
results in a compiler warning about assigning to 'id<UINavigationControllerDelegate>' from incompatible type ViewController *const __strong'
Why isn't declaring conformity to MFMessageComposeViewControllerDelegate
and implementing the delegate methods in my header enough?
There aren't even any UINavigationControllerDelegate
delegate methods to implement...
Relevant code...
Mmmmplementation:
-(void)shareTrainInformation
{
NSLog(@"Sharing...");
MFMessageComposeViewController *messageComposer = [[MFMessageComposeViewController alloc] init];
messageComposer.delegate = self;
}
Header:
@interface RRDetailViewDrillDownViewController : UIViewController <MFMessageComposeViewControllerDelegate, UINavigationControllerDelegate>
해결책
Use the composer's mailComposeDelegate property: composer.messageComposeDelegate = self;
It's because that name was already taken by an unrelated delegate declared in the superclass. (UINavigationController declares a delegate property.)