Xcode 9: Please improve error handling: -[UILabel setFrame:] and -[CALayer setFrame:] throws unfriendly exception if given a malformed CGRect

Originator:s.pankevich
Number:rdar://34568770 Date Originated:21-09-2017
Status:Open Resolved:
Product:UIKit Product Version:Version 9.0 (9A235)
Classification:Other bug Reproducible:Always (given our existing code with lots of UI)
 
Area:
UIKit

Summary:
We are seeing the UIKit crash which is happening since we have upgraded to Xcode 9. The stack trace goes through -[UILabel setFrame:] and then -[CALayer setFrame:] methods. We would like this exception / crash to not happen inside UIKit internals 8+ methods down stack but rather have a friendlier error message about offending UI component with the details of what is going wrong.

Steps to Reproduce:
The issue is always reproducible within our code, but we could not isolate it just yet to give you a minimal reproducible example unfortunately. For now we are just seeing a stack trace which does not touch our code directly and there is no enough information for us to isolate the issue.

Expected Results:
We would expect to have a descriptive error message showing to us: what we are doing wrong: the offending UI component and if it has to do with the CGRect parameter.

Actual Results:
Looking at assembly and putting symbolic breakpoints we are able to learn about the offending UILabel and will use this information to continue our investigation. It would be much easier and faster to understand this issue if this was a detailed error message: what is the offending UI component and what is the reason of the exception, like what is the offending CGRect etc.

Version/Build:
Version 9.0 (9A235)

Configuration:
Our app built with Xcode 9 in iPhone Simulator and iPhone SE device with iOS 11 are crashing. Our production app built with Xcode 8.3.3 is not crashing.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!