【发布时间】:2014-04-09 21:01:35
【问题描述】:
我正在尝试使用 Bufferapp API 自动为社交网络创建一些缓冲区并让它们在自动时间发布。
我需要使用他们的 API,特别是 this method,在我的帖子中发送图片和文本。我几乎都想通了,但我想不出使用此 API 发送图像的正确方法。
我用谷歌搜索了一下,但我似乎无法找到一种方法来做到这一点。我见过的所有示例都通过 POST 发送整个图像,但它们似乎没有使用 API 格式。
换句话说,我怎么能做到这样?
https://webservice.com/api/send_post?access_token=123&text=huehuehue&image=__
编辑:我没有附加任何源代码,因为我不知道如何处理 NSImage 的“转换”为可以使用 API URL 发送的东西,但这是我正在尝试的代码生成:
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[queue addOperationWithBlock:^{
NSURL *create = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.bufferapp.com/1/updates/create.json?access_token=%@", kToken, nil]];
NSString *text = @"text=%23Anime"; //Encoding so this is #Anime
NSString *now = @"now=0";
//Somehow add an NSImage to the http body.
}];
【问题讨论】:
标签: objective-c macos http nsimage