I'm working on several projects and it happens the same error.
I still can't figure out what's causing it. Is it the problem with my code or Xcode 9 beta?
MyApp[22724:4000717] API error: (null) returned 0 width, assuming UIViewNoIntrinsicMetric
@rmaddy correctly linked to another SO answer however there are other possibilities related to auto layout practices.
The message could also be related to auto layout implementations and unique constraints defined in your project. It seems that this message normally does not appear when using a real device.
UIKit framework -> UIView API Global Variable UIViewNoIntrinsicMetric
UIViewNoIntrinsicMetric
The absence of an intrinsic metric for a given numeric view property.
UIView Implementation Practices
Every UIView subclass should implement the intrinsicContentSize and return the size that it thinks is suitable for it. For example:
UIViewNoIntrinsicMetric
instead of the width. return CGSizeMake(UIViewNoIntrinsicMetric, 50)
UIView base implementation of updateConstraints
will call the intrinsicContentSize and it will use the content size returned from it to add constraints to the UIView.
UIView API Property intrinsicContentSize
intrinsicContentSize
The natural size for the receiving view, considering only properties of the view itself.
Custom views typically have content that they display of which the layout system is unaware. Setting this property allows a custom view to communicate to the layout system what size it would like to be based on its content. This intrinsic size must be independent of the content frame, because there’s no way to dynamically communicate a changed width to the layout system based on a changed height, for example.
If a custom view has no intrinsic size for a given dimension, it can use
UIViewNoIntrinsicMetric
for that dimension.
Conclusion
Xcode error:
returned 0 width, assuming UIViewNoIntrinsicMetric
Therefore we can get an idea that Xcode is assuming a UIViewNoIntrinsicMetric size since a width size of 0 was returned by some UIView in your project.
If you are still getting the message when deploying on a real device then I'd pay extra attention to your layout constraints.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With