title: iOS Twitter Sign In Memory Leaks
body: <p>When implementing Twitter Sign In, I have noticed what I believe to be two memory leaks occurring when the keyboard is shown in the Twitter login view controller. I was just wondering if anyone had spotted this and could tell me about what is happening here. I'm fairly certain that I have implemented the log in method correctly as it is fairly straight forward (only consists of one method call) and the example code is well documented:</p>
  
  <pre><code>// Objective-C
  [[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
    if (session) {
        NSLog(@"signed in as %@", [session userName]);
    } else {
        NSLog(@"error: %@", [error localizedDescription]);
    }
  }];
  </code></pre>
  
  <p>The two leaked objects are "_UIKeyboardTextSelectionController" and "_UIKeyboardBasedNonEditableTextSelectionGestureController".</p>
  
  <p><a href="https://i.stack.imgur.com/FxDVA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FxDVA.png" alt="enter image description here"></a></p>
  
  <p>Also I thought this detail may be useful, however I have very basic knowledge of memory management and the Leaks instrument so please excuse my inexperience. When left to run a Root Leak named "_UIKeyboardTextSelectionController" seems to accumulate over time and can be seen visually in the Cycles &amp; Roots view of the detail pane (see image below).</p>
  
  <p><a href="https://i.stack.imgur.com/5bNwp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5bNwp.png" alt="enter image description here"></a></p>