Xcode 8 storyboard toolsVersion = 11201 is causing issues when I run my app

I upgraded to Xcode 8, which updates the storyboard in several ways, including advancing the toolsVersion from 10116 to 11201.


Now, when I run the app, one of my table views goes past all of the content when I programmatically scroll it to the bottom (so only blank white is on the screen, no cells, unless I scroll up). I spent hours on this and finally isolated the problem: it is the storyboard toolsVersion.


If I switch the toolsVersion back to 10116 (but leave all the other Xcode 8 changes to the storyboard in place and make no code changes), this does not happen. When I advance the toolsVersion up to 11201 (again, leaving all the other Xcode 8 changes to the storyboard in place and making no code changes), this problem happens.


This makes no sense to me and seems like an Xcode 8 storyboard bug.

Answered by ethan.g in 189649022

Turns out that my table view had a contentInset that was being set in viewDidLoad based on the size of an image view, and the size of that image view is now (as of toolsVersion 11201) being reported as 1000 x 1000 (instead of 40 x 14) in viewDidLoad (because the size hasn't been loaded yet). The solution was to make an outlet to the image view's constraint and use that (whose "constant" value is always 14, even at the point of viewDidLoad) for the contentInset.

Accepted Answer

Turns out that my table view had a contentInset that was being set in viewDidLoad based on the size of an image view, and the size of that image view is now (as of toolsVersion 11201) being reported as 1000 x 1000 (instead of 40 x 14) in viewDidLoad (because the size hasn't been loaded yet). The solution was to make an outlet to the image view's constraint and use that (whose "constant" value is always 14, even at the point of viewDidLoad) for the contentInset.

The fact that toolsVersion 11201 causes the size of certain things to be reported as 1000 is odd. And it's causing other issues in my app that I'm having to solve. You really cannot rely on a view's frame until after it has finished being laid out. I noticed that a lot of the <rect key="frame" ... /> elements have been removed from the storyboard XML by Xcode 8, and I think it's doing that for all views who have fully qualified constraints. So the fact that the frames are no longer specified in the storyboard for those views may be why the frame is weird until the constraints and everything have been evaluated (i.e. weird in viewDidLoad, but fine in viewDidAppear).

Xcode 8 storyboard toolsVersion = 11201 is causing issues when I run my app
 
 
Q