Question

I'm trying to preview images and other files from the app's documents folder. I have implemented Quicklook in my App, and it looks like it's launching, but it pops up with a blank screen and logs the following warning:

warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A334)/Symbols/System/Library/Frameworks/QuickLook.framework/DisplayBundles/Image.qldisplay/Image (file not found). warning: No copy of Image.qldisplay/Image found locally, reading from memory on remote device. This may slow down the debug session.

I'm not sure the warning is the reason it's not showing, but I figured I'd include it anyway. I'm not getting any actual error from the QLPreviewController itself. Is there any way I can test it for success/failure?

This is how I set it up:

QLPreviewController* preview ;
UIView* quickLookView ;

And:

preview = [[QLPreviewController alloc] init];
preview.dataSource = self;
preview.delegate = self;

//set the frame from the parent view
CGFloat w= backgroundViewHolder.frame.size.width; 
CGFloat h= backgroundViewHolder.frame.size.height;
preview.view.frame = CGRectMake(0, 0,w, h);

//refresh the preview controller
[preview reloadData];
[[preview view] setNeedsLayout];
[[preview view] setNeedsDisplay];
[preview refreshCurrentPreviewItem];

//add it  
[quickLookView addSubview:preview.view];

And

- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index
{
    NSURL* returnurl = [NSURL fileURLWithPath: @"/var/mobile/Applications/02D1E9A2-8B31-4323-8FDE-CC1786EFBD43/Documents/Photos/Image%20photos/7_Essay_PK33.jpg" ] ;
    NSLog(@"--- previewController %@ index: %d!" , returnurl , index ) ;

    return returnurl ;
    //return [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[documents objectAtIndex:index] ofType:nil]];
}

What's going wrong? And how can I fix it?

Was it helpful?

Solution

Check the following items: 1:Make sure your image is in the bundle and copy to document successfully.

2: Make sure you have add the QuickLook framework right and successfully---you can check
whether it's included in "BuildPhases".

3: Check whether you have forgot "#import "

4: Double check to set currentPreviewItemIndex or the delegate method"numberOfPreviewItemsInPreviewController".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top