Reputation: 455
It seems to be working but I am getting a compile warning inside of my showEmailModalView method on the line: picker.mailComposeDelegate = self; It says "Passing MyAppViewController *const_strong to parameter of incompatible type 'id" If anyone can help with this I will appreciate it.
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
switch (result)
{
case MFMailComposeResultCancelled:
break;
case MFMailComposeResultSaved:
break;
case MFMailComposeResultSent:
break;
case MFMailComposeResultFailed:
break;
default:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email" message:@"Sending Failed - Unknown Error :-("
delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
break;
}
[self dismissModalViewControllerAnimated:YES];
}
-(void) showEmailModalView {
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
backUpTape = tapeDisplay.text;
[picker setMessageBody:backUpTape isHTML:NO];
picker.navigationBar.barStyle = UIBarStyleBlack;
[self presentModalViewController:picker animated:YES];
}
- (void) alertView: (UIAlertView *) alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 1) {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setValue:tapeDisplay.text forPasteboardType:@"public.utf8-plain-text"];
} else if (buttonIndex == 2)
[self showEmailModalView];
}
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView: self.view];
if (CGRectContainsPoint(tapeDisplay.frame, location)) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Copy"
message: @""
delegate: self cancelButtonTitle: @"Cancel"
otherButtonTitles: @"Copy", @"email", nil];
[alert show];
}
}
Upvotes: 0
Views: 376
Reputation: 43330
Looks like somebody isn't conforming to the MFMailComposeViewControllerDelegate. Put it in a pair of these <>
in the .h file and see if the error goes away when you build and run again.
Upvotes: 1