I've got a problem with my universal app. In particular my problem is about using MessageComposerViewController
(MCVC). I want to send email with a pdf attached and all works done. My problem occurs when I dismiss the MessageComposerViewController
. Indeed when I remove MCVC from main view I'd like that subviews in mainView continue to has exclusiveTouch tag flagged to true.
This behavior occurs when I run my app on iPad but it doesn't happen when I use iPhone. When I use iPhone device, after I've sent an e-mail (or after I've aborted it) the touch signal is captured by mainview and I don't know the reason.
My hierarchy is:
mainView (GameView) within some subviews that I use to manage file actions: (open file, send file, remove file). To apply the right actions I've linked a UITapGestureRecognizer
to the 3 buttons. After MCVC is dismissed, I'd like to continue using the three buttons but I can't.
I post some code:
MCMessageComposerViewController.h:
@interface MessageComposerViewController : UIViewController{
MFMailComposeViewController *mc;}
MCMessageViewController.m:
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{
self.feedbackMsg.hidden = NO;
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
self.feedbackMsg.text = @"Result: Mail sending canceled";
break;
case MFMailComposeResultSaved:
self.feedbackMsg.text = @"Result: Mail saved";
break;
case MFMailComposeResultSent:
self.feedbackMsg.text = @"Result: Mail sent";
break;
case MFMailComposeResultFailed:
self.feedbackMsg.text = @"Result: Mail sending failed";
break;
default:
self.feedbackMsg.text = @"Result: Mail not sent";
break;
}
[mc.navigationController popViewControllerAnimated:YES];
[mc dismissViewControllerAnimated:YES completion:nil];
[self.view removeFromSuperview];
}
- (void)displayMailComposerSheet:(NSString *)_fileName{
NSString *pathFile = @"blablablaPath";
NSString *emailTitle = "blablablaTitle";
mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitle];
// Get the resource path and read the file using NSData
NSData *fileData;
while(!fileData){
fileData = [NSData dataWithContentsOfFile:pathFile];
if(fileData) break;
[f_t createPdfWithName:_fileName];}//create pdf file if it isn't exist
[mc addAttachmentData:fileData mimeType:@"application/pdf" fileName:_fileName];
[self presentViewController:mc animated:YES completion:NULL];}
GameView.m:
- (void)sendFile:(UITapGestureRecognizer *)recognizer{
mail = [[MessageComposerViewController alloc] init];
[self addSubview:mail.view];
[mail displayMailComposerSheet: fileName];
}
I'd like to post an image but I've not enough reputation to do this...
Please help me!!! :-)