Search code examples
iosios7

Sharing to Instagram in ios 7


So I used to have the following snippet of code for iOS6

NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];

if([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
    NSURL *imageURL = [NSURL fileURLWithPath:originalImagePath];

    self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:imageURL];
    self.documentInteractionController.delegate = self;
    self.documentInteractionController.UTI = @"com.instagram.exclusivegram";
    [self.documentInteractionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
}

but with the release of iOS7 once I get the dialog window that shows the Instagram icon with Open in Instagram I'm getting the following error:

Invalid LSOpenOperation request - No applications found to open document

Does anyone know if Instagram has changed their UTI for iOS7 or what is the appropriate developer hooks to make it work on 7?


Solution

  • My file extension was the culprit.

    As per Instagram Docs:

    You must first save your file in PNG or JPEG (preferred) format and use the filename extension ".ig". Using the iOS Document Interaction APIs you can trigger the photo to be opened by Instagram.

    Looks like the older version of instagram it was not enforced (I was getting away with just passing .jpg or .png files)

    Now we must have the .ig file extension...