title: Why am I unable to post to Twitter using SLComposeViewController?
body: <p>I'm trying to post an article title and an article URL to twitter and then append the app's name to the end of the tweet. So something like </p>
  
  <blockquote>
    <p>"How to grow a cactus (via @appname)" <em>attached URL</em></p>
  </blockquote>
  
  <p>I was having trouble figuring out how to balance the length of the title and URL to make sure that the tweet doesn't exceed 140 characters. So if the URL is really long, cut some of the article title off so it can be under 140 characters.</p>
  
  <p>Looking at <a href="https://dev.twitter.com/docs/ios/using-tweet-sheet" rel="noreferrer">Twitter's guidelines for <code>SLComposeViewController</code></a> they state this part:</p>
  
  <blockquote>
    <p>Note that the methods for setting initial content respond with Boolean values; this allows you, the developer, to not have to worry about the current count of characters in the body of the Tweet that you are initializing. If the method returns YES, there was enough room to add the content. If the method returns NO, the content you attempted to add would result in a Tweet longer than 140 characters. The logic for character counting also takes into effect the current number of characters required for t.co URL wrapping.</p>
  </blockquote>
  
  <p>(From the "Code Example" section.)</p>
  
  <p>Given that, I wrote the following code to build a tweet and balance the URL length and article length:</p>
  
  <pre><code>if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
      SLComposeViewController *twitterViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
      [twitterViewController addURL:[NSURL URLWithString:self.article.url]];
  
      NSString *titleToShare = self.article.title;
      while ([twitterViewController setInitialText:[NSString stringWithFormat:@"%@ (via @SyllableApp)", titleToShare]]) {
          titleToShare = [titleToShare substringToIndex:titleToShare.length - 1];
      }
  
      [self presentViewController:twitterViewController animated:YES completion:nil];
  }
  </code></pre>
  
  <p>Which basically adds the URL then constructs the rest of the tweet by looping through the <code>setInitialText:</code> method until it returns <code>YES</code>, decreasing the length of the title by 1 each time it returns <code>NO</code> in order to get closer to the required length.</p>
  
  <p><strong><em>But it never returns YES!</em></strong> Even when I know it should. I was using one article where it could potentially exceed 140 characters as the title is 105 characters long and the URL is 55, plus the app credit. So it should theoretically be able to shorten the title down and then add it fine, but it never happens.</p>
  
  <p>So what's going on? How do I accomplish link attachment with <code>SLComposeViewController</code>?</p>