首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >STTwitter无法从iphone上发布图片

STTwitter无法从iphone上发布图片
EN

Stack Overflow用户
提问于 2014-09-15 21:05:54
回答 1查看 561关注 0票数 2

这是我用来将图片发布到twitter的代码块。

代码语言:javascript
复制
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);

    }];

我得到了成功的响应,但没有发布图片

EN

回答 1

Stack Overflow用户

发布于 2014-09-16 16:09:16

正如推特的documentation中解释的那样,这个方法确实会发布图像并返回一个mediaID,然后可以在tweet中使用。当您想要发布多张图片并在将来的推文中使用它们时,请使用此方法。

如果您想在一行中同时发布图像和推文,请参阅POST statuses/update_with_media端点的STTwitter's methods

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25848818

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档