BuySellAds.com

My book Barcodes with iOS 7 is nearing completion. Buy it now to get early access!
Our DNA is written in Objective-C
Jump

Radar: QLPreviewController Exception

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.

This bug is filed as rdar://14216503 and on OpenRadar.

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’

Regression

The same code worked without issue on iOS 5.

Notes

Sample Code: QuickLookBug project in our Radar Samples GitHub repository.


Categories: Bug Reports

%d bloggers like this: