TWTweetComposeViewController should make available the current Tweet length

Originator:phillips1988
Number:rdar://12316996 Date Originated:17-Sep-2012
Status:Open Resolved:
Product:iOS SDK Product Version:6.0
Classification:Feature Reproducible:N/A
 
Summary: The TWTweetComposeViewController class displays a tweet compose view. The developer can set initial values for this (URL, initial text, images). But there is no smart way to manage remaining space left for a particular tweet. 
When adding links or images, an unpredictable amount of characters is being used from Twitter's 140 character allowance. 
Since TWTweetComposeViewController doesn't add a resource if there is insufficient space - if there is only 40 characters remaining and we want to set initial text which has a length of 50, we end up with no text.
The developer now has to implement a loop in order to trim the text until TWTweetComposeViewController returns YES for setInitialText:
A more ideal solution would be a readonly property "remainingCharacters" or, an optional NSError sent with setInitialText: such as setInitialText:withError, this error could upon failure hint as to the current status of the tweet.
By notifying the user that only 40 characters are remaining, the developer can then trim accordingly.

Another solution might be that TWTweetComposeViewController automatically truncates the text with three periods "..." when it is too long, since this is a problem more with dynamic initial text generation from apps using stringWithFormat adding possibly a dynamic name or description.

Steps to Reproduce: Use TWTweetComposeViewController to add an image, a link and then set an initial text with a string which is longer then the remaining space left for that tweet.

Expected Results: Informative feedback from TWTweetComposeViewController allowing the developer to reprioritise and/or trim text according to the constraints.

Actual Results: If content is too long, setInitialText returns NO and the developer has to implement some code to guess/loop until success etc which uses more computation then necessary and can be inconsistent between applications/developers.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!