我们可以使用iOS应用程序在instagram中发布图像吗

我们可以使用iOS应用程序在instagram中发布图像吗,ios,instagram,Ios,Instagram,我需要使用Instagram共享图像。我已使用创建了客户端ID和客户端机密。我已经在StackOverflow中搜索过了,但是我没有找到任何有用的链接。谁能帮我解决这个问题。是的,你可以在instagram上发布图片,如下代码所示 -(IBAction)uploadimage:(UIButton*)sender { NSURL *instagramURL = [NSURL URLWithString:@"instagram://"]; if ([[UIApplication

我需要使用Instagram共享图像。我已使用创建了客户端ID和客户端机密。我已经在StackOverflow中搜索过了,但是我没有找到任何有用的链接。谁能帮我解决这个问题。

是的,你可以在instagram上发布图片,如下代码所示

-(IBAction)uploadimage:(UIButton*)sender
{

    NSURL *instagramURL = [NSURL URLWithString:@"instagram://"];

    if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
    {

       CGSize size=CGSizeMake(612, 612);

       UIImage *TajImage = [UIImage imageNamed:@"gujarat.jpg"];

       UIImage *image = [self scale:TajImage toSize:size];

       NSString  *jpgPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"instagram.igo"];


       [UIImageJPEGRepresentation(image, 1.0) writeToFile:jpgPath atomically:YES];

       CGRect rect = CGRectMake(0 ,0 , 0, 0);

       NSURL *fileURL = [NSURL fileURLWithPath:jpgPath];

       self.docFile = [UIDocumentInteractionController interactionControllerWithURL:fileURL];

       self.docFile.delegate = self;

       [self.docFile setUTI:@"com.instagram.exclusivegram"];

       [self.docFile setAnnotation:@{@"InstagramCaption" : @"Gujarti Lion,Girnar,India"}];

       [ self.docFile presentOpenInMenuFromRect:rect inView:self.view animated:YES];

       [[UIApplication sharedApplication] openURL:instagramURL];

    }
}
在instagram上上传图像:


试试下面的链接这可能会对你有所帮助,用你的一些代码更新了我的代码,效果不错,但问题是它会把我带到我的instagram时间线,而不是添加照片视图,是否必须注册?要重定向到发布图像?我还想知道,即使在开发阶段,是否也必须向Instagram注册我的应用程序?“[[UIApplication sharedApplication]openURL:instagramURL];”这是额外的删除,它解决了问题,但由于未捕获的异常“NSInvalidArgumentException”,导致终止应用程序时出现错误
***,原因:'-[\uu NSCFType URL]:未识别的选择器发送到实例0x147d67c0'***第一次抛出调用堆栈:(0x2698cf87 0x340ebc77 0x2699237d 0x26990259 0x2698C1D68 0x2a450e89 0x275e3065 0x27688277 0x892eb5 0x88d3fd 0x89455b 0x895885 0x347c9e25 0x347c9b78)libc++abi.dylib:以NSException类型的未捕获异常终止