Note that there are some explanatory texts on larger screens.

plurals
  1. POaddSubview not calling QLPreviewControllerDataSource instances when offline
    primarykey
    data
    text
    <p>I have the following piece of code to add a <code>QLPreviewController</code> subview </p> <pre><code>{ QLPreviewController *preview = [[QLPreviewController alloc] init]; preview.delegate = self; preview.dataSource = self; [self addChildViewController:preview]; [self.view addSubview:preview.view]; [preview didMoveToParentViewController:self]; self.previewController = preview; } -(NSInteger) numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller { return 1; } -(id) previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)index { return self.url; } </code></pre> <p><code>self.url</code> is an <code>NSURL that</code> is located in NSTemporaryDirectory - file://localhost//.../blah.pdf</p> <p>My issue is that when my laptop is connected to the internet, the document shows up as a subview, but when my laptop is not connected, <code>numberOfPreviewItemsInPreviewController</code> &amp; <code>previewItemAtIndex</code> do not get called.</p> <ul> <li>I've tried a vanilla program with a simple view controller, and it seemed to work fine. (My app is more complex than that).</li> <li>When I try presenting the document as a modal view, it seems to work irrespective of whether or not the simulator is connected to the internet. <code>[self presentViewController:preview animated:NO completion:nil];</code> --> works consistently.</li> </ul> <p>I need to get the subview working for online &amp; offline modes, it would be great if someone could help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload