I have a very strange (and serious) problem.
My application uses UIDocumentInteractionController to share a PDF document. When the user selects the Mail option in the controller pop-up window, the MailCompose window opens. But neither the Submit button nor the Cancel button in this window causes the MailCompose window to be rejected, which means that the user is stuck and must kill the application. However, the mail is still coming out.
Here's the catch: This only happens in iOS8 (both versions have been released so far) and only in apps installed through the AppStore. The exact version of the application that runs on my device using USB debugging works fine.
Here is the code:
-(void)sharePDF:(id)sender { @try { NSURL *fileURL = [NSURL fileURLWithPath:currentFileObject.LocalPath]; if(fileURL) { //UIDocumentInteractionController NSString *newPath; @try { //Create a copy of the file for sharing with a friendly name if (currentFileObject.isSpecialReport) { newPath = [svc saveReport:[NSData dataWithContentsOfURL:fileURL] ToFile:[NSString stringWithFormat:@"%@.pdf", currentFileObject.ReportName]]; } else { newPath = [svc saveReport:[NSData dataWithContentsOfURL:fileURL] ToFile:[NSString stringWithFormat:@"%@.pdf", currentFileObject.PatientFullName]]; } } @catch (NSException *exception) { return; } NSURL *newURL = [NSURL fileURLWithPath:newPath]; self.docController = [UIDocumentInteractionController interactionControllerWithURL:newURL]; self.docController.delegate = self; if (currentFileObject.isSpecialReport) { self.docController.name = [NSString stringWithFormat:@"Pathology - %@", currentFileObject.ReportName]; } else { self.docController.name = [NSString stringWithFormat:@"Pathology - %@", currentFileObject.PatientFullName]; } [self.docController presentOptionsMenuFromBarButtonItem:btnShare animated:YES]; } } @catch (NSException *exception) { return; } }
I do not use any of the delegate methods, since they are not required, I also do not use the preview functions.
The most unpleasant thing for me is that the application from the AppStore behaves differently than my local one, although the code is identical. My next step is to use the new beta tools of the developer (Test Flight) to republish the application, hoping that I can reproduce the problem.
EDIT: I found a similar question on SO here: Unable to delete the email sheet called from the UIDocumentInteractionController in iOS 8. After reading this post, I think it's worth mentioning that I sent the application to the AppStore via Xcode 5 (latest version before Xcode 6). Could this be a factor here? Does Apple use the same version on its side as the version from which the application was originally created?
source share