使用swift 2在twitter中发布图像

时间:2016-05-16 23:37:58

标签: json swift twitter swift2.2

我想在twitter中发布图片,即时通讯使用swift 2.我尝试了许多不同的方法,但我无法在twitter文档中找到正确的代码。到目前为止,JSON的结果是这个

{
    "expires_after_secs" = 86400;
    image =     {
        h = 540;
        "image_type" = "image/png";
        w = 540;
    };
    "media_id" = 732352461227233281;
    "media_id_string" = 732352461227233281;
    size = 514691;
}

1 个答案:

答案 0 :(得分:0)

Twitter API文档:

https://dev.twitter.com/rest/reference/post/media/upload

您必须提供全部参数。

参数

**media** [required]: The raw binary file content being uploaded. Cannot be used with media_data.

**media_data** [required]: The base64-encoded file content being uploaded. Cannot be used with media.

**additional_owners** [optional]: A comma-separated list of user IDs to set as additional owners allowed to use the returned media_id in Tweets or Cards. Up to 100 additional owners may be specified.