title: uitextfield positionFromPosition:offset not working emojis
body: <p>I am trying to implement my own keyboard containing emojis. 
  For this purpose I am inserting the emoji in the cursor position.</p>
  
  <p>This works fine if no 4-bytes emoji characters exist in UITextField. Otherwise the app gets crashed. </p>
  
  <p>I am posting the insertion code here. Can someone point out how to solve the issue?</p>
  
  <pre><code>UITextField *field = self.textField;
  UITextRange *range = field.selectedTextRange;
  int pos = [field offsetFromPosition:field.beginningOfDocument toPosition:range.end];
  NSString * firstHalfString = [field.text substringToIndex:pos];  
  NSString * secondHalfString = [field.text substringFromIndex:pos];  
  field.text = [NSString stringWithFormat: @"%@%@%@", firstHalfString, emoticon, secondHalfString];
  UITextPosition *newPos = [field positionFromPosition:field.beginningOfDocument offset:pos + 1];
  field.selectedTextRange = [field textRangeFromPosition:newPos toPosition:newPos];
  </code></pre>
  
  <p>this line returns nil if there are emojis in the text:</p>
  
  <pre><code>UITextPosition *newPos = [field positionFromPosition:field.beginningOfDocument offset:pos + 1];
  </code></pre>