objective-cswiftiphonexcodeuidocumentpickerviewcontroller

Presenting the UIDocumentPickerViewController and dismissing it keeps the presented view controller in freeze


How can I present the UIDocumentPickerViewController and dismissing it keeps the presented view controller in freeze


Solution

  • Problem is that you open UIDocumentPickerViewController in PDFBrowserViewController so when you dismiss UIDocumentPickerViewController but PDFBrowserViewController was not dismissed.

    solution 1: open UIDocumentPickerViewController directly in top viewcontroller without use of PDFBrowserViewController.

    solution 2: after dismiss UIDocumentPickerViewController dismiss the parent controller in Delegate methods.

    UIWindow *window = [[[UIApplication sharedApplication] windows] firstObject];
    UIViewController *vc = [window rootViewController];
    [vc dismissViewControllerAnimated:true completion:nil];