NSLayoutConstraint Error when accessing UIActivityViewController - Xcode 7 b3 iOS9

I'm getting this error after implementing a share feature on my app. My app contains a tableView that pulls youtube videos. I implemented the tableView editActionsForRowAtIndexPath to swpie for sharing options. On swiping I get a button which opens this share sheet.

The app works well - but xcode throws this error.

https://www.youtube.com/watch?v=xxxxxxxxxxx

2015-07-22 22:49:02.875 YTDemo[31401:4903247] 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.

Please help

Accepted Reply

The error seems to have gone with XCode 7 Beta 5.

Replies

I am having the same problem with an obj-c project on xcode 7 b4 when implementing sharing on selected text in a UITextView. Would love to here from Apple if it a problem with our implementation or just a bug in xcode 7 or ios9.

Try opening the app (where you get the error) in different devices. Mine crashes (sometimes) on the iPad Air.


What I think the problem is that when we allow the share sheet to come up, it violates some constraints we've put earlier. So we get the error. But i may well be wrong.

Mine seems to fail on all device types. Do you get a different error when selecting define instead of share? I am getting the following error, I assume it is connected to the error that occurs when presenting share.


Unbalanced calls to begin/end appearance transitions for <_UIFallbackPresentationViewController: 0x794d6d80>.

One idea that I had is that it may be related to a view appearing on top of an app that requires fullscreen, but I tested that and it failed independent of that. If you come across a fix or others with similar problems, I would love to hear about it.

this happened when i presented a smaller view controller. I fixed it by manually fixing all of the sizes of the window.

Can you please share what you actually did and how you fixed it?

We experience the same behaviour when opening an UIActivityViewController from a button. I opened a bug-report with the number 22113188, the example-project can be found at https://github.com/Sipeso/UIActivityViewControllerAndNSLayoutConstraints. Please duplicate the bug-report, if you didn't already file one by yourself.

I couldn't find your bug report.

Where did you search for it? You can find it at http://www.openradar.me/22113188

Don't you file one here? At the apple dev site? I'm a newbie.

I have the same warning (on the iPhone 6 simulator) when I present a document interaction controller like this:


let interactionController = UIDocumentInteractionController(URL: documentURL)


interactionController.delegate = self
         
interactionController.presentOptionsMenuFromRect(
                self.view.frame,
                inView: self.view,
                animated: true)

Setting up the suggested symbolic breakpoint at `_NSLayoutConstraintRedundantAdd` stops my app, and the last call in the stack for which source code is available is precisely the call for `presentOptionsMenuForRect()`.

I think the problem is ... calling these "external" screens is breaking the autolayout ... mostly by adding the some constraints again. I'm not sure how to fix this though.


Maybe debug the screens one by one ... ouch!

The error seems to have gone with XCode 7 Beta 5.