3

I am trying to print a txt file from within a iPad 8.x application. So, I have this code:

- (void)onOpenWith:(UIButton *)theButton path:(NSString *)path
{


    NSURL *URL = [NSURL fileURLWithPath:path];

    if (URL) {



        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];

        self.documentInteractionController.delegate = self;
        [self.documentInteractionController presentPreviewAnimated:YES];

    }
}

#pragma mark - UIDocumentInteractionControllerDelegate

- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
    return self;
}

- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
    return self.view;
}

- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
    return self.view.frame;
}

Now everything is going as expected, I see a preview of the file, then I touch the icon on the top right corner of the screen and I am able to share the document in those applications that can handle it. However, if I touch PRINT I get this error message:

Application tried to present inside popover with transition style other than UIModalTransitionStyleCoverVertical

and the app crashes. Sure, i understand it, but to which viewcontroller should I apply this transition? I have no control on the popover showing the print dialog...

In iOS 7 (real iPad not simulator) everything works...

Can anybody help me?

Thanks Fabio

Fabio Ricci
  • 395
  • 1
  • 4
  • 16
  • Fabio, did you figure this out? I'm running into the same issue. – Chad Oct 14 '14 at 18:47
  • Hi Chad, no news... I even spent one of the two support tickets with Apple, but they could not reproduce the steps, even if I attached the whole project... They told me to write to the UIKIT development team, but then I solved it by leaving this way and rewriting the whole project (it was at an early stage) with Cordova... – Fabio Ricci Oct 15 '14 at 19:40

1 Answers1

0

I also came across this issue, and the solution was that I had to build and run my app with Xcode 6 installed.

On my older machine, I have Xcode 5.1.1, and when run from there, this same issue appeared, and some more issues from this view (like cannot dismiss mail controller when opened from the top right corner).

Boris
  • 389
  • 4
  • 12