Not showing pdf, grey screen only

Jura's Avatar


04 Jun, 2016 10:37 PM

I am having a problem showing my .pdf. I am using latest Swift and I have successfully incorporated via framework (latest build) and bridging header. I am using your snippets.txt file as example. This is my code:

    let documentManager = MFDocumentManager(fileUrl: magazine.urlInDocumentsDirectory)
    let readerViewController = ReaderViewController(documentManager: documentManager)
    documentManager.resourceFolder = magazine.urlInDocumentsDirectory?.path
    self.presentViewController(readerViewController, animated: true, completion: nil)

where "urlInDocumentsDirectory" is path to my downloaded pdf file. In attachment there is is screenshot. First, it shows your splash screen, that is ok. But after that, it shows only grey screen. I have checked, my .pdf file is downloaded correctly. I am using latest iOS 9.3. I have tried on iPhone 5s, iPhone 6 and iPhone 6s, all are 9.3.

Best regards,

  1. 1 Posted by Gabriel Nopper on 14 Mar, 2017 08:59 PM

    Gabriel Nopper's Avatar

    I might be VERY late to the party, but since this might be useful for someone else:

    For some reason, it fails to load pdfs from the documents path in more recent iOS versions.

    Here's what i've done instead:

        // fileData is a NSData you extract from the documents path. Your PDF.
            NSData *fileData = [NSData dataWithContentsOfFile:yourDocumentPath];
            struct CGDataProvider *data = CGDataProviderCreateWithCFData((CFDataRef) fileData);
        // Now InitWithDataProvider instead
            MFDocumentManager *documentManager = [[MFDocumentManager alloc] initWithDataProvider:data];

    Worked for me as of today, in Xcode 8.2.1, iOS 9.1.

    Hope it helps.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • Simulator_Screen_Shot_05_Jun_2016_00.33.50.png 17.6 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

15 Apr, 2020 04:25 AM
26 Feb, 2020 07:23 AM
27 Jun, 2019 06:08 AM
23 Nov, 2018 01:54 PM
14 Nov, 2018 04:37 PM