OGeek|极客世界-中国程序员成长平台

标题: ios - STTwitter 无法从 iphone 发布图像 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 01:50
标题: ios - STTwitter 无法从 iphone 发布图像

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

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);

    }];

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



Best Answer-推荐答案


正如 Twitter 的 documentation 中所述,此方法确实发布图像并返回一个 mediaID,然后可以在推文中使用它。如果您想发布多张图片并在以后的推文中使用它们,请使用此方法。

如果您想将图片与推文一起发布,请连续发布,请参阅 STTwitter's methods对于 POST statuses/update_with_media 端点。

关于ios - STTwitter 无法从 iphone 发布图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25848818/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4