I have an image and I want to export it to Instagram, so I can post it.
The code I use is:
NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"]; if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) { NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.igo"]; UIImage *image = [UIImage imageNamed:@"01.png"]; NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:YES]; NSURL *imageUrl = [NSURL fileURLWithPath:savedImagePath]; NSLog(@"%@",imageUrl); UIDocumentInteractionController *docController = [[UIDocumentInteractionController alloc] init]; docController.delegate = self; docController.UTI = @"com.instagram.exclusivegram"; docController.URL = imageUrl;
When I launch the application, the application shows a button written by "Instagram", its icon, but when I touch it, the button disappears and nothing happens. The application did not crash, but nothing happened.
What did I miss in my code?
Relations Bruno
source share