Strange leak when using QuickLook framework in iOS

2019-08-28 05:52发布

问题:

I have used QuickLook framework for opening one 2 page pdf file modally, and everything works. However, after testing (Instruments Leaks) the project with different iOS versions and devices, I have noticed strange leak that was appearing when running Intruments leaks on iPhone 3GS + iOS 4.0 device. The leak was appearing after opening previewer modally on the parent view and closing previewer. Strange, but no leak was appearing when testing on simulator and iPhone 4 + iOS 5.0. I'm using Xcode 4.2.

The code is pretty straightforward. Here's a button action that opens previewer modally:

-(IBAction)openFiles:(id)sender{

QLPreviewController *preview = [[QLPreviewController alloc] init];

preview.dataSource = self;
preview.currentPreviewItemIndex = 0; //for previewing only one pdf file

[self presentModalViewController:preview animated:YES];

[preview release];

}

Here are the details for a leak in Instruments: