我正在开发一个需要将图像发布到 Instagram 的应用程序。我跟着这些链接1和 链接2
但是,这对我不起作用。之后,我找到了这个链接: 如何在 iOS 中的 Instagram 上分享图片?
我根据这个进行了更改,但它没有发布图像。这是我的代码:
CGRect rect = CGRectMake(0 ,0 , 100, 100);
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIGraphicsEndImageContext();
NSString *staticPath = [[NSBundle mainBundle] pathForResource:@"JB" ofType:@"igo"];
NSString *path_font = [staticPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *fileAppend = [[NSString alloc] initWithFormat:@"file://"];
path_font = [[NSString alloc] initWithFormat:@"%@%@", fileAppend, path_font];
NSLog(@"path_font----%@",path_font);
NSLog(@"filepath_static image----%@",filepath_static);
NSURL *igImageHookFile = [[NSURL alloc] initWithString:path_font];
NSLog(@"igImageHookFile url is---%@",igImageHookFile);
self.dic.UTI = @"com.instagram.photo";
self.dic = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
self.dic=[UIDocumentInteractionController interactionControllerWithURL:igImageHookFile];
[self.dic presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
任何建议将不胜感激。