Xcode 11 crashes when copy/pasting views from different storyboards

Viewed 2682

I have a problem with Xcode 11 running on Catalina (it had the same problem with Moave). When I try to copy/paste a view or a ViewController from one storyboard to another Xcode crashes with this exception:

...
Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
Sending paste: to IBStructureAreaDockView from <NSMenuItem: 0x7fe24030ddd0 Paste>
ProductBuildVersion: 11A1027
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-15400/InterfaceBuilderKit/WidgetIntegration/View/IBViewIntegration.m:2451
Details:  There should only be 1 parent of all the constraint items extracted from the pasteboard: {(
)}
Object:   <IBUIView: 0x7fe23db1c600>
Method:   -ibDidExtractObjects:fromPasteboard:intoDocument:context:
Thread:   <NSThread: 0x7fe23ac17e80>{number = 1, name = main}
Hints:   
  0: Sending paste: to IBStructureAreaDockView from <NSMenuItem: 0x7fe24030ddd0 Paste>
Backtrace:
  0   -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in IDEKit)
  1   _DVTAssertionHandler (in DVTFoundation)
  2   _DVTAssertionFailureHandler (in DVTFoundation)
  3   -[NSView(IBViewIntegration) ibDidExtractObjects:fromPasteboard:intoDocument:context:] (in IDEInterfaceBuilderKit)
  4   -[IBUIView(IBUIViewIntegration) ibDidExtractObjects:fromPasteboard:intoDocument:context:] (in IDEInterfaceBuilderCocoaTouchIntegration)
  5   -[IBDocument ibDidExtractObjects:fromPasteboard:context:] (in IDEInterfaceBuilderKit)
  6   -[IBDocument insertObjectsFromPasteboard:ofType:asChildrenOfObject:atIndex:context:finishExtractingObjectsBlock:] (in IDEInterfaceBuilderKit)
  7   -[IBDocument insertOrMoveChildrenFromPasteboard:ofType:asChildrenOfObject:atIndex:context:finishExtractingObjectsBlock:] (in IDEInterfaceBuilderKit)
  8   -[IBDocument addOrMoveChildrenFromPasteboard:ofType:toObject:context:finishExtractingObjectsBlock:] (in IDEInterfaceBuilderKit)
  9   -[IBStoryboardDocument addOrMoveChildrenFromPasteboard:ofType:toSceneGroup:context:] (in IDEInterfaceBuilderKit)
 10   -[IBSceneDockViewController performDockPasteWithPasteboard:context:] (in IDEInterfaceBuilderKit)
 11   -[IBSceneDockViewController dockViewPerformPaste:] (in IDEInterfaceBuilderKit)
 12   -[IBStructureAreaDockView paste:] (in IDEInterfaceBuilderKit)
 13   -[NSApplication(NSResponder) sendAction:to:from:] (in AppKit)
 14   __37-[DVTApplication sendAction:to:from:]_block_invoke.86 (in DVTKit)
 15   DVTInvokeWithFailureHint (in DVTFoundation)
 16   -[DVTApplication sendAction:to:from:] (in DVTKit)
 17   -[NSMenuItem _corePerformAction] (in AppKit)
 18   -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] (in AppKit)
 19   -[NSMenu performKeyEquivalent:] (in AppKit)
 20   routeKeyEquivalent (in AppKit)
 21   -[NSApplication(NSEvent) sendEvent:] (in AppKit)
 22   -[IDEApplication sendEvent:] (in IDEKit)
 23   -[NSApplication run] (in AppKit)
 24   NSApplicationMain (in AppKit)
 25   main (in Xcode)
 26   start (in libdyld.dylib)

Performing @selector(paste:) from sender NSMenuItem 0x7fe24030ddd0
abort() called

Application Specific Signatures:
[parentsOfItemsInConstraints count] == 1
...

Is it happening to someone else? Is this something not supported by storyboard?

12 Answers

The issue for me was because i had the app running in the background. After closing the emulator i was able to copy/cut and paste (even in different storyboard files).

Xcode->Preferences-Locations Click on the little arrow underneath "Derived Data" and delete that folder. After I did this I could cut and paste between storyboards.

Same issue here. I think it's a bug with the new Xcode 11.

Found a quick workaround. Instead of copying and pasting view controllers which will cause Xcode to crash you can use cmd + D to duplicate the view controllers . But this will only be useful if in the same storyboard

Select View Controller, Edit > copy

On another storyboard, Edit > paste

i found a quick hack, go to your project navigator then right click on your .storyboard file and choose open as Source code.

you will get your storyboard in xml format, search and copy the class of the controller, and paste the same way you copied it in the other storyboard. make sure to get the whole code of the view controller.

            <!--Detail View Controller-->
    <scene sceneID="n6l-mp-H1E"> .... </scene>

Its seems like kernel has issues while pasting the entire storyboard , But this only happens when the simulator apps is open . Close simulator app and try to paste it it works perfect

I tried clearing derived data and cleaning the project and the project folder and force restarted Xcode multiple times but all that didn't work.

Also I couldn't duplicated the views since I needed to copy in a different storyboard.

What eventually did the trick for me was to open an assistant editor and drag/drop whichever views I needed to copy.

CLOSE the SIMULATOR! That will work and allow the copy-paste of view controllers from different storyboards.

Two possible cases:

  • either you have to copy and paste from one project to another;
  • or within the same project, but different or same storyboard.

You can fix it by closing the emulator running in the background and then copy and paste or by copying and pasting from your storyboard (XML format).

I have found that instead of selecting the scene, selecting the view controller and perform a copy and paste to new storyboard worked.

enter image description here

Drag and drop worked instead of copy/paste for me. Happy coding!

drag_and_drop

I faces this issue lots of time, it seems like due to new version of Xcode.

Here is the solution that works for me.

Delete Derived Data and restart the XCode.

Clean & build the project.

Make sure XCode should not busy in following tasks:

  • Building Project

  • Indexing (wait until finish)

  • Running Project

  • Storyboard opening

Now you can try to copy one view controller from one storyboard to another it can be possible.

Related