Created
June 18, 2014 16:22
-
-
Save luispedrofonseca/74e1ac65da03f335a8a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL *appURL = [NSURL URLWithString:@"instagram://app"]; | |
if([[UIApplication sharedApplication] canOpenURL:appURL]) | |
{ | |
// Image | |
UIImage *image = [UIImage imageWithContentsOfFile:imagePath]; | |
// Post | |
[UIImageJPEGRepresentation(image, 1.0) writeToFile:[self photoFilePath] atomically:YES]; | |
NSURL *fileURL = [NSURL fileURLWithPath:[self photoFilePath]]; | |
self.dic = [UIDocumentInteractionController interactionControllerWithURL:fileURL]; | |
self.dic.UTI = @"com.instagram.exclusivegram"; | |
self.dic.delegate = self; | |
if (message) | |
self.dic.annotation = [NSDictionary dictionaryWithObject:message forKey:@"InstagramCaption"]; | |
[self.dic presentOpenInMenuFromRect:CGRectZero inView:nativeWindow.rootViewController.view animated:YES]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment