QLPreviewController Exception

Number:rdar://14216503 Date Originated:20 Jun 2013
Status:Open Resolved:
Product:iPhone SDK Product Version:6.0
Classification:Crash/Hang/Data Loss Reproducible:Always

According to the QLPreviewItem Protocol Reference for iOS:

"If the item is not available for preview, this property’s getter method should return nil. In this case, the Quick Look preview controller displays a “loading” view."

If you return nil for the previewItemURL as suggested the app is terminated with an exception.

Steps to Reproduce:

- Run the provided sample app on iOS 6 or iOS 7 simulator
- Push the Button

Expected Results:

The preview controller should appear and display a spinning activity indicator.

Actual Results:

Immediately after appearing the preview controller throws an exception which differs by iOS version:

iOS 6: 'setObjectForKey: key cannot be nil'
iOS 7: '-[NSURL initFileURLWithPath:]: nil string parameter'


The same code worked without issue on iOS 5.

Sample Code: QuickLookBug at https://github.com/cocoanetics/radarsamples


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!