Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [0 nan; 280 524]'

Somewhere along the line here, you are getting an invalid output that is causing rect to have the value NaN (a special float value meaning "not a valid float number", most commonly caused by division by zero). Is it possible that you have passed an invalid or nonsensical UITextRange to -firstRectForRange? What happens if UITextPosition *start references the last character in the text, when you then create another text position that is one character past the end?