3

After downloading Xcode 7.0 and migrating to Swift 2.0, i am getting the following error.

Attempt to add this NSLayoutConstraint to an engine in which it already exists. This can cause engine corruption. Break on void _NSLayoutConstraintRedundantAdd() to debug. This will be logged only once. This may break in the future.

Saurabh Jain
  • 3,013
  • 3
  • 11
  • 9
  • What is the question ? – A-Live Jul 17 '15 at 16:58
  • 1
    You are apparently adding redundant constraints which had slipped by unnoticed in the past, but it's now warning you of this. You need to identify where this is happening and then remedy the issue. – Rob Jul 17 '15 at 17:18
  • My project is huge in size. Any suggestions as to how can i debug such an issue? – Saurabh Jain Jul 17 '15 at 17:21
  • They suggest adding a break on `_NSLayoutConstraintRedundantAdd`, so that's the first thing to try. Also, if you run the app and then hit the "view debugger" button, in the view debugger you can then tap on the "constraints" button and then click through the various subviews and see if you see obvious redundancies. Or navigate through the list of constraints in the jump bar above the view debugger panel. Or in the debug navigator in the leftmost panel, you can click on the view debugger icon and navigate the tree of views/constraints there, too. – Rob Jul 17 '15 at 20:31
  • Same issue here, but with ObjC No code changes. When running on iOS 9 these errors are logged, though everything displays correctly. – OrangeDog Jul 20 '15 at 16:42
  • @Rob How do i add a break on _NSLayoutConstraintRedundantAdd? – Saurabh Jain Jul 20 '15 at 23:43
  • See [Adding a Symbolic Breakpoint](https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/adding_a_symbolic_breakpoint.html). Note, this is only going to be useful if adding constraints programmatically (and you might have to intersperse calls to `layoutIfNeeded` so that it breaks within your frame). If all of your constraints are in IB, then you'll have to rely upon tools like the view debugger. – Rob Jul 21 '15 at 03:56
  • I get the same error when I present a `UIDocumentInteractionController` instance with `presentOptionsMenuFromRect()` from the main view of my root view controller (single view application). Setting up the suggested breakpoint stops my app, and the last method in the call stack for which source code is available (i.e., my code) is that method call. – Nicolas Miari Aug 07 '15 at 02:39
  • Addendum: Beta 4 here. – Nicolas Miari Aug 07 '15 at 02:40

1 Answers1

0

Seems that for few people it got fixed by updating to Xcode 7 beta 5

https://forums.developer.apple.com/thread/11909

Imran
  • 769
  • 1
  • 9
  • 21