【问题标题】:STTwitter could not post image from iphoneSTTwitter 无法从 iphone 发布图像
【发布时间】:2014-11-09 00:36:20
【问题描述】:

这是我用来在推特上发布图片的代码块。

NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"info" ofType:@"png"];
    UIImage *image = [[UIImage alloc] initWithContentsOfFile:imagePath];
   NSData *imageData = UIImageJPEGRepresentation(image,.05);
    [_twitter postMediaUploadData:imageData fileName:@"splash_02" uploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {

    } successBlock:^(NSDictionary *imageDictionary, NSString *mediaID, NSString *size) {
        NSLog(@"xfdf=%@",imageDictionary);

    } errorBlock:^(NSError *error) {
          NSLog(@"xfdferror=%@",error);

    }];

我得到响应成功,但没有发布图像

【问题讨论】:

    标签: ios iphone twitter sttwitter


    【解决方案1】:

    正如 Twitter 的 documentation 中所解释的,此方法会发布图像并返回 mediaID,然后可以在推文中使用它。如果您想发布多张图片并在以后的推文中全部使用它们,请使用此方法。

    如果您想连续发布图片和推文,请参阅STTwitter's methods 以获取POST statuses/update_with_media 端点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-23
      • 1970-01-01
      相关资源
      最近更新 更多