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://…
three dots at the end of line. i need to print complete text without truncation.
Twitter sample search result JSON Data
{
"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
}
To provide full backward compatibility, the original 140-character 'text' field, and the entity objects parsed from that, were retained. In the case of Tweets longer than 140 characters, this root-level 'text' field would become truncated and thus incomplete.
The default per-minute rate limit for Full-Archive search is 120 requests per minute, for an average of 2 queries per second (QPS). This average QPS means that, in theory, 2 requests can be made of the API every second.
All Twitter APIs that return Tweets provide that data encoded using JavaScript Object Notation (JSON). JSON is based on key-value pairs, with named attributes and associated values. These attributes, and their state are used to describe objects. At Twitter we serve many objects as JSON, including Tweets and Users.
The Twitter API has been changed recently, to support new rules regarding the 280 characters limit.
tweet_mode
with value extended
to your request parameters.text
in the JSON response has been replaced by full_text
More info here: https://dev.twitter.com/overview/api/upcoming-changes-to-tweets
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:
let text = status["retweeted_status"]["full_text"]
.
Keep in mind that you should still include tweet_mode=extended
in your request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With