Integrating the application with instagram .. How can I do this, please help in advance is the code that I tried
NSURL *instagramURL = [NSURL URLWithString:@"instagram://location?id=1"]; if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) { NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"Image.ig"]; UIImage *image = [UIImage imageNamed:@"instagram.jpeg"]; 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.photo"; docController.URL = imageUrl; [docController setURL:imageUrl]; [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES]; }
source share