UIDocumentInteractionController - Error reading document

I am viewing documents in my application using UIDocumentInteractionController. However, sometimes the documents display well, other times the Interaction Manager displays the message "Error reading document". I know this is not a document issue because the same document sometimes shows and sometimes does not.

Restarting the device fixes this problem temporarily - so it would be a memory issue, but oddly enough I am not getting any memory warnings. Any ideas on how to get this to work reliably please?

Notes:

  • The interactioncontroller document preview is rejected and the controller is released when finished to ensure the preview does not remain in memory
  • I had the same problem using quicklook controller
0


source to share


3 answers


After much testing, it looks like this issue is limited to iPad 1. Restart is the only workaround.



+1


source


Since you believe this document is correct and you believe your code is correct, you should start looking for other factors. Two that come to mind:



  • Application state. Is there something about the current state of the application that might interfere with the preview? You mentioned that you don't get any memory warnings, but looked at how much memory the application is using, when the preview succeeds and when it fails?

  • Document state. Is it possible that the file won't open for some reason, for example the file is already open? Can you open the file in any other way?

0


source


Your application might be trying to render the document before os finishes writing it to the sandbox folder. The speed of this operation will depend somewhat on what else is happening in the background (other apps, downloading emails, checking iOS for updates, etc.). It also explains why restarting the device might temporarily fix the problem.

To test this, you can check for this error and then try opening the document again after a few seconds.

Without special code or logs, it's hard to say a lot more.

0


source







All Articles