Open Instagram in IOS 9 with UIDocumentInteractionController

Hi,

thi is my code to open Instagram App directly with an image. As stated in Apple document relative to UIDocumentInteractionController and in Instagram hook page this snippet of code should open instagram directly with the image, but in all testing conditions it open the action sheet with all the app compatible with the extension saved.

I've also whitelisted instagram in LSApplicationQueriesSchemes.

How can i achive this result? It's a bug or a new security feature of IOS 9?


Thanks in advance for your help


NSURL *instagramURL = [NSURL URLWithString:@"instagram:/

if ([[UIApplication sharedApplication] canOpenURL:instagramURL])

{

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *getImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.ig"];

[UIImagePNGRepresentation(capturedImage) writeToFile:getImagePath atomically:YES];


NSURL *imageFileURL =[NSURL fileURLWithPath:getImagePath];

NSLog(@"imag %@",imageFileURL);


self.dic.delegate = self;

self.dic.UTI = @"com.instagram.photo";

self.dic = [self setupControllerWithURL:imageFileURL usingDelegate:self];

[self.dic presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

} else


{

//prompt for app missing

}


- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL

usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate {

UIDocumentInteractionController *interactionController =

[UIDocumentInteractionController interactionControllerWithURL: fileURL];

interactionController.delegate = interactionDelegate;


return interactionController;

}

Open Instagram in IOS 9 with UIDocumentInteractionController
 
 
Q