I am trying to share video captured from my app to instagram but app crashes. Photos getting shared successfully.
Code used:
NSData* videoData = [NSData dataWithContentsOfURL:info[@"UIImagePickerControllerMediaURL"]];
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"instagram.igo"];
[videoData writeToFile:path atomically:YES];
NSURL *fileURL=[NSURL fileURLWithPath:path];
NSDictionary *fileCaption = @{ @"InstagramCaption" : @"Shared by my app" };
[self setDocumentInteractionController:[self setupControllerWithURL:fileURL usingDelegate:self]];
[self.documentInteractionController setUTI:@"com.instagram.exclusivegram"];
[self.documentInteractionController setAnnotation:fileCaption];
[self.documentInteractionController presentOpenInMenuFromRect:rect inView:self.view animated:YES];
On capturing the video, my app redirects and opens Instagram app but immediately it crashes.
Can someone help me with what I am doing wrong or tell me the correct method to share video to Instagram?