Search code examples
iosobjective-ciphoneios8uidocumentinteraction

UIDocumentInteractionController takes long time to show options


I have used UIDocumentInteractionController for sharing the files but it open menu options after 25 seconds in iOS 8 beta 5 and works fine in iOS 7.1.

I have verified the log which I pasted below

Errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo=0x79bd5ef0 {NSLocalizedDescription=query cancelled}
2014-08-27 15:02:05.634 Localwire[82067:1364165] Unknown activity items supplied: (
        {
        "com.microsoft.excel.xls" = <d0cf11e0 a1b11ae1 00000000 00000000 00000000 00000000 3e000300 feff0900 06000000 00000000 00000000 10000000 01000000 00000000 00100000 cb070000 01000000 feffffff 00000000 00000000 62000000 e3000000 64010000 e5010000 66020000 e7020000 68030000 e9030000 6a040000 eb040000 6c050000 ed050000 6e060000 ef060000 70070000 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff

Im not sure what's the problem is.


Solution

  • I have used UIActivityViewController which didn't shown up any problem. This bug is still present in iOS 8 Release version

    So I'm going with UIActivityViewController fix.

    I have used TYOpenInAppActivity to show the third party apps in UIActivityViewController

    NSURL *URL = [NSURL fileURLWithPath:filePath];
    TTOpenInAppActivity *openInAppActivity = [[TTOpenInAppActivity alloc] initWithView:self.view andBarButtonItem:barButton];
    UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:@[URL] applicationActivities:@[openInAppActivity]];
        // Create pop up
        self.activityPopoverController = [[UIPopoverController alloc] initWithContentViewController:activityViewController];
        // Store reference to superview (UIPopoverController) to allow dismissal
        openInAppActivity.superViewController = self.activityPopoverController;
        // Show UIActivityViewController in popup
        [self.activityPopoverController presentPopoverFromRect:((UIButton *)sender).frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    

    You can find the TTOpenInAppActivity controller in below link.

    https://github.com/honkmaster/TTOpenInAppActivity