why text field value is truncated and how can i get complete value. As of now i am trying to get text field value like below
为什么文本字段值被截断,我怎样才能获得完整的值。截至目前,我正在尝试获取如下文本字段值
do {
if let responseObject = try NSJSONSerialization.JSONObjectWithData(response, options: []) as? [String:AnyObject],
arrayStatuses = responseObject["statuses"] as? [[String:AnyObject]] {
let arrTweets:NSMutableArray = NSMutableArray()
for status in arrayStatuses {
let text = status["text"]!
print(status["text"]!)
}
}
}
output is
输出是
RT @WarfareWW: #Russia/#India may hold launches of BrahMos cruise missiles from Su-30MKI vs sea/grnd trgts at the end of this year https://…
RT @WarfareWW:#Russia /#India可能会在今年年底从Su-30MKI对海/ grnd trgts发射BrahMos巡航导弹https:// ...
three dots at the end of line. i need to print complete text without truncation.
在行尾有三个点。我需要打印完整的文本而不截断。
Twitter sample search result JSON Data
Twitter样本搜索结果JSON数据
{
"created_at": "Mon Aug 01 08:07:43 +0000 2016",
"id": 760024194079916032,
"id_str": "760024194079916032",
"text": "RT @khalidasopore: #KEXIT #KASHEXIT #KashmirKillings #Inida #Pakistan Just trend it my dear Indians to save #Kashmir from Pak Goons https:/…",
"truncated": false
}
2 个解决方案
#1
28
The Twitter API has been changed recently, to support new rules regarding the 280 characters limit.
Twitter API最近已更改,以支持有关280个字符限制的新规则。
- To get the full text of the tweet, add parameter
tweet_mode
with valueextended
to your request parameters. - 要获取推文的全文,请添加参数tweet_mode,并将值扩展到您的请求参数。
- Field
text
in the JSON response has been replaced byfull_text
- JSON响应中的字段文本已被full_text替换
More info here: https://dev.twitter.com/overview/api/upcoming-changes-to-tweets
更多信息:https://dev.twitter.com/overview/api/upcoming-changes-to-tweets
#2
1
The status in this example is a retweet, and the text for retweets will be truncated to 140 characters even after including tweet_mode=extended
. The full text of the original tweet is in the retweeted_status
field of the JSON response. Here's what you want:
此示例中的状态是转发,即使包含tweet_mode = extended,转发的文本也将被截断为140个字符。原始推文的全文位于JSON响应的retweeted_status字段中。这是你想要的:
let text = status["retweeted_status"]["full_text"]
.
let text = status [“retweeted_status”] [“full_text”]。
Keep in mind that you should still include tweet_mode=extended
in your request.
请记住,您仍应在请求中包含tweet_mode = extended。
#1
28
The Twitter API has been changed recently, to support new rules regarding the 280 characters limit.
Twitter API最近已更改,以支持有关280个字符限制的新规则。
- To get the full text of the tweet, add parameter
tweet_mode
with valueextended
to your request parameters. - 要获取推文的全文,请添加参数tweet_mode,并将值扩展到您的请求参数。
- Field
text
in the JSON response has been replaced byfull_text
- JSON响应中的字段文本已被full_text替换
More info here: https://dev.twitter.com/overview/api/upcoming-changes-to-tweets
更多信息:https://dev.twitter.com/overview/api/upcoming-changes-to-tweets
#2
1
The status in this example is a retweet, and the text for retweets will be truncated to 140 characters even after including tweet_mode=extended
. The full text of the original tweet is in the retweeted_status
field of the JSON response. Here's what you want:
此示例中的状态是转发,即使包含tweet_mode = extended,转发的文本也将被截断为140个字符。原始推文的全文位于JSON响应的retweeted_status字段中。这是你想要的:
let text = status["retweeted_status"]["full_text"]
.
let text = status [“retweeted_status”] [“full_text”]。
Keep in mind that you should still include tweet_mode=extended
in your request.
请记住,您仍应在请求中包含tweet_mode = extended。