Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 545
Prashanth Avatar asked Aug 27 '14 10:08

Prashanth


3 Answers

UIActivityViewController is very fast in iOS 8. However you can't open images in other 3rd party applications like Instagram, Vintiqu, and so forth.

Also, presentOpenInMenuFromRect is really faster than presentOptionsMenuFromRect in iOS 8 (iOS 8.0.2 too). But, presentOpenInMenuFromRect does not show sharing actions.

I want to provide users with "Save Image, Assign to Contact, Copy, Print, ..." on the sharing view. So, my current workaround is just as below, :(

    if( SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
        [self.udic presentOpenInMenuFromRect:CGRectMake(self.view.frame.size.width/2 - 49/2, self.view.frame.size.height-49, 49, 49)  inView:self.view animated:YES];
    } else {
        [self.udic presentOptionsMenuFromRect:CGRectMake(self.view.frame.size.width/2 - 49/2, self.view.frame.size.height-49, 49, 49)  inView:self.view animated:YES];
    }
like image 72
alones Avatar answered Nov 13 '22 06:11

alones


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

like image 45
Prashanth Avatar answered Nov 13 '22 06:11

Prashanth


My workaround so far is to use presentOpenInMenuFromRect instead of presentOptionsMenuFromRect, this will show less items but at least it's not causing memory issues. QuickLook option seems to be buggy under iOS 8 beta 5 as well, pdf quick look is not working either, beside movie memory issues.

like image 1
Calin Chitu Avatar answered Nov 13 '22 04:11

Calin Chitu