Skip to content

Instantly share code, notes, and snippets.

@leoiphonedev
Created January 17, 2017 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leoiphonedev/ef88b02536557e5f50b5c15cf8c6ae60 to your computer and use it in GitHub Desktop.
Save leoiphonedev/ef88b02536557e5f50b5c15cf8c6ae60 to your computer and use it in GitHub Desktop.
UIImage *instaImage = [UIImage imageNamed:@"imagetoShare.png"];
NSString* imagePath = [NSString stringWithFormat:@"%@/image.igo",[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES) lastObject]];
[[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil];
[UIImagePNGRepresentation(instaImage) writeToFile:imagePath atomically:YES];
UIDocumentInteractionController *_docController = [UIDocumentInteractionController interactionControllerWithURL:
[NSURL fileURLWithPath:imagePath]];
_docController.UTI = @"com.instagram.exclusivegram";
[_docController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment