0

I downloaded file from network, but in advance I don't know what type of file, I name it as PDF file, thus destroying some files, I use QLPreViewController 's method “+ canPreviewItem” judging whether the file can be previewed, in my mind if the pdf file is broken(QLPreViewController actually can’t preview), it will return NO. but it always returns yes, how do I can judge whether the file can be previewed ? Can you give me some help ?

1 Answers1

0

+[QLPreviewController canPreviewItem:] is just telling you, based on the UTI of the item argument, if Quick Look knows how to display this UTI or not.

It is not doing any introspection of the item (which would be very costly).

You can't escape fixing your server to return an appropriate file extension and MIME type, unfortunately.

Thomas Deniau
  • 2,488
  • 1
  • 15
  • 15