iOS 8: UITableViewHeaderFooterView contentView requiring positive height/width causes unsatisfiable constraints

Originator:tomabuct
Number:rdar://18362327 Date Originated:16-Sep-2014
Status:Open Resolved:
Product:iOS SDK Product Version:8.0 (12A365)
Classification:Other Bug Reproducible:Always
 
Summary:
If you add constraints to a UITableViewHeaderFooterView's contentView requiring that it have a positive height or width, an unsatisfiable constraint exception is thrown involving a constraint with identifier UIView-Encapsulated-Layout-Width/Height.

Steps to Reproduce:
1. Add constraints to UITableViewHeaderFooterView's contentView requiring that it have a positive height or width. See the attached code for an example.
2. Use the UITableViewHeaderFooterView in a UITableView as a section header.

Expected Results:
A 10pt height table view section header

Actual Results:
A 10pt height table view section header with the following logged to the console:

2014-09-16 22:40:09.400 TableViewSectionHeaderFooterOS8Bug[5485:100111] Unable to simultaneously satisfy constraints.
	Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x7f9f0a7267f0 H:|-(5)-[UILabel:0x7f9f0a725400'hiii']   (Names: '|':_UITableViewHeaderFooterContentView:0x7f9f0a724ea0 )>",
    "<NSLayoutConstraint:0x7f9f0a726bb0 H:[UILabel:0x7f9f0a725400'hiii']-(5)-|   (Names: '|':_UITableViewHeaderFooterContentView:0x7f9f0a724ea0 )>",
    "<NSLayoutConstraint:0x7f9f0a72a290 'UIView-Encapsulated-Layout-Width' H:[_UITableViewHeaderFooterContentView:0x7f9f0a724ea0(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7f9f0a726bb0 H:[UILabel:0x7f9f0a725400'hiii']-(5)-|   (Names: '|':_UITableViewHeaderFooterContentView:0x7f9f0a724ea0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

Version:
iOS 8.0 (12A365)

Notes:
repro app attached

Configuration:
iPhone 6 Simulator

Attachments:
'TableViewSectionHeaderFooterOS8Bug.zip' was successfully uploaded.

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!