'Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil' 'Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil' ios ios

'Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil'


This crash appears when you run your app with Margins and baselines in constraints on iOS 7.

To find and remove all dummy constraints strings you can do this:

Xcode doesn't highlight all these constraints correctly in Interface Builder, so you can use this solution:

  1. Close Xcode
  2. Open your storyboard file in your favorite text editor
  3. Find all occurrences using the regex: (\w)Margin" and replace all of them with the pattern: \1" (the regex version is the one used in Sublime 2)
  4. Find and remove from the storyboard file all the strings using the pattern: .*"baseline".*\n
  5. Now save the file and open it in Xcode
  6. Fix all appeared misaligns: find all warnings and press _"Update constraints for all views" to save the original position of all the views.
  7. Profit!

Update:I found that "baseline" constraints causes crashes also, but Xcode doesn't show any warnings about these constrains!


Solved. It was because of Auto Layout constraints.

There were Labels that did not know to determine its width.

But why only works on iOS 8?I pinned two constraints to determine the width in Xcode 6

Trailing Space to: superviewLeading Space to: superview

when pinning constraints, there is an option 'Constraint to Margin', which is checked by default in Xcode 6. And Older versions does not support that.


You are right @Kyle. This is causing due to Auto Layout constraints. @Mazen, In my case too it was "First Baseline Alignment", removed it and worked. Here are some checks to detect/solve the problem.

  1. To detect which storyboard causing this error you can perform a quick check. In "File Inspector", Uncheck the "Use Auto Layout" for the selected storyboard. Now, clean and build your application. If still getting the same error means the constraint causing this error is in another storyboard or in code.

  2. Once you identify the storyboard, resolve the errors and warnings displayed by storyboard using Add Missing Constraints or other similar options.

  3. To filter which constraint causing this error. Remove 3-4 constraints at a time(you can remove more to make it fast) to check if the error resolved. Once error resolved, identify the exact constraint which was causing this error.

  4. Regarding "Constraint to Margin". In my case this is checked in few constraints but its not causing any error/warning below iOS8.

  5. You can use this link to resolve auto layout issues. Resolving Auto Layout Issues

Hope this will help someone.


matomo