iOS 9 UIDocumentInteractionController не открывает файл с приложением

В предыдущей iOS я использовал этот код и UIDocumentInteractionController, чтобы открыть файл из моего приложения в другом приложении. Начиная с iOS 9 на экране появляется UIDocumentInteractionController, я выбираю вариант «Копировать в», но ничего не происходит. Как я могу это решить?

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];
}

person spacecash21    schedule 01.10.2015    source источник


Ответы (1)


вы должны управлять временем отклика при открытии: -

-(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;
}
person Lokesh Kumawat    schedule 02.10.2015