简体   繁体   English

Xcode 11 从不同的故事板复制/粘贴视图时崩溃

[英]Xcode 11 crashes when copy/pasting views from different storyboards

I have a problem with Xcode 11 running on Catalina (it had the same problem with Moave).我对在 Catalina 上运行的 Xcode 11 有问题(Moave 也有同样的问题)。 When I try to copy/paste a view or a ViewController from one storyboard to another Xcode crashes with this exception:当我尝试将视图或 ViewController 从一个 storyboard 复制/粘贴到另一个 Xcode 时,会出现以下异常:

...
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?这是 storyboard 不支持的东西吗?

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).关闭模拟器后,我能够复制/剪切和粘贴(即使在不同的 storyboard 文件中)。

Xcode->Preferences-Locations Click on the little arrow underneath "Derived Data" and delete that folder. Xcode->Preferences-Locations 单击“Derived Data”下方的小箭头并删除该文件夹。 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.我认为这是新的 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.您可以使用 cmd + D 复制视图控制器,而不是复制和粘贴会导致 Xcode 崩溃的视图控制器。 But this will only be useful if in the same storyboard但这只有在同一个 storyboard 中才有用

Select View Controller, Edit > copy Select 查看 Controller,编辑 > 复制

On another storyboard, Edit > paste在另一个 storyboard 上,编辑 > 粘贴

i found a quick hack, go to your project navigator then right click on your.storyboard file and choose open as Source code.我找到了一个快速的 hack,go 到您的项目导航器,然后右键单击 your.storyboard 文件并选择作为源代码打开。

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. 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.确保获取视图 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.似乎 kernel 在粘贴整个 storyboard 时出现问题,但这仅在模拟器应用程序打开时发生。 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.我尝试清除派生数据并清理项目和项目文件夹并强制重新启动 Xcode 多次,但所有这些都不起作用。

Also I couldn't duplicated the views since I needed to copy in a different storyboard.此外,我无法复制视图,因为我需要复制不同的 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.这将起作用并允许从不同的故事板复制粘贴视图控制器。

it is crazy but my xcode didn't crash when i close right view(inspectors) before paste view这太疯狂了,但是当我在粘贴视图之前关闭右视图(检查员)时,我的 xcode 没有崩溃

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.或在同一个项目中,但不同或相同的 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).您可以通过关闭在后台运行的模拟器然后复制和粘贴或通过从 storyboard(XML 格式)复制和粘贴来修复它。

I have found that instead of selecting the scene, selecting the view controller and perform a copy and paste to new storyboard worked.我发现不是选择场景,而是选择视图 controller 并执行复制并粘贴到新的 storyboard 工作。

在此处输入图像描述

Drag and drop worked instead of copy/paste for me.对我来说,拖放而不是复制/粘贴。 Happy coding!快乐编码!

拖放

I faces this issue lots of time, it seems like due to new version of Xcode.我经常遇到这个问题,似乎是由于 Xcode 的新版本。

Here is the solution that works for me.这是适合我的解决方案。

Delete Derived Data and restart the XCode.删除派生数据并重新启动 XCode。

Clean & build the project.清理并构建项目。

Make sure XCode should not busy in following tasks:确保 XCode 不应忙于以下任务:

  • Building Project建筑工程

  • Indexing (wait until finish)索引(等到完成)

  • Running Project运行项目

  • Storyboard opening Storyboard开口

Now you can try to copy one view controller from one storyboard to another it can be possible.现在您可以尝试将一个视图 controller 从一个 storyboard 复制到另一个视图是可能的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM