Coordinate UIDocumentPickerViewController's dismissal

Originator:and.mikhaylov
Number:rdar://20447945 Date Originated:07-Apr-2015 01:48 PM
Status:Resolved Resolved:YES
Product:iOS SDK Product Version:8.2
Classification:Other Bug Reproducible:Always
 
Summary:
I would like to display UIAlertController after document picker dismissed. However currently there is no way to coordinate that. It would be really helpful to have a delegate method to be notified that picker dismissed or move didPickDocumentAtURL to the point when controller already dismissed.

Steps to Reproduce:

1. Present UIDocumentPickerViewController
2. Present UIAlertController from didPickDocumentAtURL

Expected Results:
UIAlertController presented from parent controller.

Actual Results:
UIAlertController does not even show up and I receive a warning in console:

Warning: Attempt to present <UIAlertController: 0x19084a50> on <MYViewController: 0x190a08f0> whose view is not in the window hierarchy!

Regression:

Notes:
Currently I skip one run loop to hook up transitionCoordinator.

- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url {
    dispatch_async(dispatch_get_main_queue(), ^{
        NSAssert(controller.transitionCoordinator, @"UIDocumentPickerViewController does not have transitionCoordinator?");
        
        [controller.transitionCoordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
            
        } completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
            [self _showAlertController];
        }];
    });
}

Comments

Resolved in 8.3.

By and.mikhaylov at Aug. 5, 2015, 2:09 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!