Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIDocumentInteractionController no longer works in iOS6

I have an app that shares with instagram built for iOS5 and now in iOS6, sharing no longer works although canOpenURL returns true and code executes. The images are saved to the documents folder of the application with a .igo extension. This is passed to instagram with com.instagram.exclusivegram.

The code is below, it enters the if statement and displays "here in" but does not open the Share With dialog like it used to at the bottom of the screen.

        NSLog(@"%@", _imgToUpload);
        NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
        if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
            uidController = [[UIDocumentInteractionController alloc] init];
            //imageToUpload is a file path with .igo file extension
            uidController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:_imgToUpload]];
            uidController.UTI = @"com.instagram.exclusivegram";
            uidController.delegate = self;
            CGRect navRect = self.view.frame;
            [uidController presentOpenInMenuFromRect:navRect inView:[UIApplication sharedApplication].keyWindow animated:YES];
            NSLog(@"here in");
        }

_imgToUpload is providing the correct filepath as well.

Thank you, Nick

like image 509
Nick Pirollo Avatar asked Sep 27 '12 23:09

Nick Pirollo


1 Answers

Just did some testing and found a solution. Do not present in the keyWindow.

[uidController presentOpenInMenuFromRect:navRect inView:self.view animated:YES];

I have tested this and it will fix the problem.

like image 137
wsidell Avatar answered Sep 21 '22 04:09

wsidell