Wednesday, October 21, 2015

UITextView Bug in Xcode - iOS App Getting hanged without throwing any error and utilising 100% of CPU.

Are you facing an issue where your entire solution / build of your iOS project is not working, all of the sudden.?

It might have worked fine previously but without any change,  a build from Apple's latest edition of Xcode (7.1) made the solution not to work.

If yes, then this might be the possible scenario.

If your project is using UITextView and if you are setting its 'Text' property from storyboard, then if the given text length is between 0-10,  the application will close / hang in an unexpected manner.

Senario:
UITextView - setting its text property in storyboard with the text length between 0 to 10.

Problem.
A view or viewController with UITextView with the mentioned scenario will not load and the application will hang with 100% of CPU usage.
If the same view controller is reached via Presenting or in navigation or by any segue, still the behaviour remains the same.

Solution:
Don't set text property for UITextView via storyboard, instead create an outlet for the TextView and set text property of any length programatically.
Or, Can still set text property via storyboard, but the text length should be greater than or equal to 10.

There is no way to track this issue. Even its not been figured out using instruments (profiling) to check which object is creating this issue.
The saddest part is the application itself will not throw any error in Xcode, but the application will go still (hang).

We expect Apple Inc to come up with a valid fix for this bug.


Thank you.
Regards,
Mithun

1 comment:

  1. Here's link to stackoverflow question regarding this issue:
    http://stackoverflow.com/questions/32611789/uitextview-with-text-less-than-10-characters-hangs-ios-9

    ReplyDelete