1

In previous iOS, I used this code and UIDocumentInteractionController to open a file, from my app, with another app. Since iOS 9, the UIDocumentInteractionController appears on the screen, I select the option "Copy to", but nothing happens. How can I solve this?

NSURL *URL = [NSURL fileURLWithPath:path];    
if (URL != nil) {
    // Initialize Document Interaction Controller
    documentController = [UIDocumentInteractionController interactionControllerWithURL:URL];

    documentController.delegate = self;
    [documentController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
}
spacecash21
  • 1,331
  • 1
  • 19
  • 41

1 Answers1

0

you have to manage your response time of open :-

-(void)exportToDropBox{
    [self performSelector:@selector(presentImagePicker) withObject:nil afterDelay:1.0];

}
-(void)presentImagePicker{

    NSURL *targetURL = [NSURL fileURLWithPath:exportedPdfFileName];
    [self presentDocumentWithURL2:targetURL];

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

- (void)presentDocumentWithURL2:(NSURL*)url {
    self.documentController = [UIDocumentInteractionController interactionControllerWithURL:url];
    self.documentController.delegate = self;
    [self.documentController presentOpenInMenuFromRect:CGRectMake(self.view.frame.size.width/2 - 49/2, self.view.frame.size.height-49, 49, 49)  inView:self.view animated:YES];
}

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller {
    self.documentController = nil;
}