twitter rest api - 发布带有用户提及的状态 [英] twitter rest api - post a status with a user mention

查看:31
本文介绍了twitter rest api - 发布带有用户提及的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用twitter的rest api,具体方法:

Using twitter's rest api, and specifcally the method :

https://dev.twitter.com/docs/api/1/post/statuses/update

我正在尝试发布一条包含用户提及 (@[screenname]) 的推文.但是,似乎 Twitter 不允许我发布任何 @ 符号,除非我对其进行编码.我尝试了几种编码技术,但似乎没有为我提供 twitter 正在寻找的合适编码.

I'm trying to post a tweet that will include a user mention ( @[screenname] ). However, it seems as though twitter won't allow me to post any @ sign unless I encode it. I've tried several encoding techniques, but non seem to provide me with the suitable encoding twitter is looking for.

至于问题,@"应该用什么代替,以便推特可以让我正确传递消息?我正在通过 iphone 应用发布命令,出于多种原因,我既不能使用 ios 6 新社交集成,也不能使用 twitter 的 ios api 包装器.

As to the question, What should "@" be substitute with so twitter will allow me to pass the message correctly? I'm posting the command via an iphone app, and from several reasons I cannot use either ios 6 new social integration, nor twitter's api wrapper for ios.

我尝试过的编码技术 -

The encoding techniques I've tried -

谢谢

推荐答案

似乎我必须使用以下方法专门对 @ 进行百分比编码:

As it seems I had to specifically percent encode the @ using the following method:

bodyString = [bodyString stringByReplacingOccurrencesOfString:@"@" withString:@"%40"];

希望它会在未来对某人有所帮助.

Hope it will help someone in the future.

这篇关于twitter rest api - 发布带有用户提及的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆