【问题标题】:Caption when posting to Instagram not working发布到 Instagram 时的标题不起作用
【发布时间】:2014-06-21 16:09:30
【问题描述】:

将照片发布到 Instagram 时,没有显示标题,它只是空的。

Instagram 是否已禁用此功能? 如果不是,我的代码可能不正确。

我是这样尝试的:

-(void)shareImageOnInstagram:(UIImage *)image
{
    //Must be 612x612
    NSString* imagePath = [NSString stringWithFormat:@"%@/instagramShare.igo", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]];
    [[NSFileManager defaultManager] removeItemAtPath:imagePath error:nil];

    UIImage *instagramImage = image;
    [UIImagePNGRepresentation(instagramImage) writeToFile:imagePath atomically:YES];
    NSLog(@"Image Size >>> %@", NSStringFromCGSize(instagramImage.size));

    self.docController.annotation = [NSDictionary dictionaryWithObject:@"mmm" forKey:@"InstagramCaption"];

    self.docController=[UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:imagePath]];
    self.docController.delegate = self;
    self.docController.UTI = @"com.instagram.exclusivegram";
    [self.docController presentOpenInMenuFromRect: self.view.frame inView:self.view animated:YES ];
}

谢谢!

【问题讨论】:

    标签: ios iphone instagram


    【解决方案1】:

    您在尝试设置注释后初始化了UIDocumentInteractionController。您必须像这样切换这两行:

    self.docController=[UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:imagePath]];
    
    self.docController.annotation = [NSDictionary dictionaryWithObject:@"Posted using #Truthly" forKey:@"InstagramCaption"];
    self.docController.delegate = self;
    self.docController.UTI = @"com.instagram.exclusivegram";
    [self.docController presentOpenInMenuFromRect: self.view.frame inView:self.view animated:YES ];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-24
      • 1970-01-01
      • 1970-01-01
      • 2015-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多