Xcode 7/Swift 2 Storyboard 崩溃 - Beta 1 和 4

标签 xcode swift swift2 xcode7-beta4

在没有警告的情况下,当我单击 Storyboard 文件时,我的 Xcode 应用程序突然开始崩溃。经过一番挖掘,我发现很多人都说这样做:

"Go to

/Library/Developer/CoreSimulator/Profiles/Runtimes

 and remove the profiles in there. Restart Xcode and it should work!"

当我在Finder中搜索该文件夹时,转到文件夹功能,它说找不到。其他人说要清除 colorPickers,但这对我来说仍然不起作用。 Xcode 在 beta 1 和 4(我有)中都崩溃了。我真的需要一些帮助。

更新此错误消息也会出现在警告通知中: 由于缺少入口点,场景无法访问,并且没有通过 -instantiateViewControllerWithIdentifier 进行运行时访问的标识符:。

这是崩溃时的弹出窗口:

Process:               Xcode [6312]
Path:                  /Applications/Xcode-beta.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               7.0 (8163.8)
Build Info:            IDEFrameworks-8163008000000000~7
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [6312]
User ID:               501

Date/Time:             2015-07-27 11:55:06.545 -0500
OS Version:            Mac OS X 10.11 (15A225f)
Report Version:        11
Anonymous UUID:        CCD99EAB-C0B0-7A00-2973-B979C02BC5E7

Sleep/Wake UUID:       AB09C466-CD98-48A5-B0DE-2D18DB8F52CB

Time Awake Since Boot: 5500 seconds
Time Since Wake:       3400 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

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

Application Specific Information:
ProductBuildVersion: 7A152u
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-8152.3/InterfaceBuilderKit/Utilities/IBPlatformToolFailureHandler.m:315
Details:  Failed to determine the values for ibLayoutInset, intrinsicContentSize, baselineOffsetFromBottom, firstBaselineOffsetFromTop, ibLayoutMargins, ibLeftBarButtonItemTitleRects, ibRightBarButtonItemTitleRects, ibLeftBarButtonItemFrames, ibRightBarButtonItemFrames, and ibTitleViewFrame of IBUINavigationBar.

Encountered an error communicating with Interface Builder Cocoa Touch Tool. If you choose to file a crash report or Radar for this issue, please zip and attach the diagnostics at "/var/folders/p7/2jw_957n4t12wkx9hm4vn_tc0000gn/T/IB-agent-diagnostics_2015-07-27_11-55-06_310000" to your crash report.

Exception name: IBPlatformToolFailureException
Exception reason: The agent crashed

Application Specific Information:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <AVPlayerViewController 0x7c84ee00> for the key path "playerController.hasEnabledAudio" from <AVPlayerViewController 0x7c84ee00> because it is not registered as an observer.'
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 169 - Device: iPad 2 - Runtime: iOS 9.0 (13A4293g) - DeviceType: iPad 2


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x06937632 __pthread_kill + 10
1   libsystem_pthread.dylib         0x068ff4a8 pthread_kill + 101
2   libsystem_c.dylib               0x066a247d abort + 156
3   libc++abi.dylib                 0x0624fae7 abort_message + 151
4   libc++abi.dylib                 0x06270683 default_terminate_handler() + 300
5   libobjc.A.dylib                 0x025960d7 _objc_terminate() + 108
6   libc++abi.dylib                 0x0626dd0d std::__terminate(void (*)()) + 14
7   libc++abi.dylib                 0x0626d93e __cxa_rethrow + 103
8   libobjc.A.dylib                 0x02595fce objc_exception_rethrow + 47
9   com.apple.CoreFoundation        0x029e3fe0 CFRunLoopRunSpecific + 672
10  com.apple.CoreFoundation        0x029e3d2b CFRunLoopRunInMode + 123
11  com.apple.Foundation            0x021af30e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 308
12  com.apple.dt.IBFoundation       0x01e2c257 -[IBAbstractPlatformTool startServingReceiveChannel:] + 471
13  com.apple.dt.IBFoundation       0x01e2c45d -[IBAbstractPlatformTool startServingWriteDescriptor:readDescriptor:] + 129
14  com.apple.dt.IBFoundation       0x01e2d0e9 +[IBAbstractPlatformTool main] + 1325
15  Interface Builder Cocoa Touch Tool  0x00058753 0x57000 + 5971
16  libdyld.dylib                   0x065f5a21 start + 1


Last command:
_ON_QUEUE_sendMessage:toChannelReturningError:during:

Backtrace of last command:
  0  0x000000011b7ca76d -[IBAbstractPlatformToolProxy _ON_QUEUE_sendMessage:toChannelReturningError:during:] (in IDEInterfaceBuilderKit)
  1  0x000000011b7ca632 __74-[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:]_block_invoke (in IDEInterfaceBuilderKit)
  2  0x00007fff8cd02c45 _dispatch_client_callout (in libdispatch.dylib)
  3  0x00007fff8cd036f2 _dispatch_barrier_sync_f_invoke (in libdispatch.dylib)
  4  0x000000010e3d7370 DVTDispatchSync (in DVTFoundation)
  5  0x000000011b7ca555 -[IBAbstractPlatformToolProxy sendMessage:toChannelReturningError:during:] (in IDEInterfaceBuilderKit)
  6  0x000000011ca0273a (in IDEInterfaceBuilderCocoaTouchIntegration)
  7  0x000000011ca17fde (in IDEInterfaceBuilderCocoaTouchIntegration)
  8  0x000000011cb48b8c (in IDEInterfaceBuilderCocoaTouchIntegration)
  9  0x000000011cb4547e (in IDEInterfaceBuilderCocoaTouchIntegration)
 10  0x000000011b9491fa -[NSView(IBViewIntegration) ibLayoutInset] (in IDEInterfaceBuilderKit)
 11  0x000000011b949606 -[NSView(IBViewIntegration) ibLayoutBounds] (in IDEInterfaceBuilderKit)
 12  0x000000011b9496bc -[NSView(IBViewIntegration) ibLayoutFrame] (in IDEInterfaceBuilderKit)
 13  0x000000011b95c631 -[NSView(IBViewIntegration) ibLoggingDescription] (in IDEInterfaceBuilderKit)
 14  0x000000011b95c80d -[NSView(IBViewIntegration) ibDefaultSubtreeDescription] (in IDEInterfaceBuilderKit)
 15  0x0000000117ea1f90 -[NSObject(IBAutolayoutObjectIntegration) ibRecursivelyAddSubtreeDescriptionToString:indentation:layoutInfo:withIteratorBlock:andAdditionalDescriptionsBlock:] (in IBAutolayoutFoundation)
 16  0x0000000117ea22d3 -[NSObject(IBAutolayoutObjectIntegration) ibSubtreeDescriptionWithLayoutInfo:withIteratorBlock:startingIndentation:andAdditionalDescriptionsBlock:] (in IBAutolayoutFoundation)
 17  0x0000000117e79729 -[IBAutolayoutArbitrationUnit debugDescription] (in IBAutolayoutFoundation)
 18  0x000000011c9d1428 (in IDEInterfaceBuilderCocoaTouchIntegration)
 19  0x000000011b7a6e51 +[IBPlatformToolFailureHandler failureHandlerWithContext:failure:diagnosticsHandlerBlock:] (in IDEInterfaceBuilderKit)
 20  0x000000011c9d2022 (in IDEInterfaceBuilderCocoaTouchIntegration)
 21  0x000000011b6a2e9e __72-[IBDocumentAutolayoutManager updateAutolayoutStatusInArbitrationUnits:]_block_invoke (in IDEInterfaceBuilderKit)
 22  0x000000011b69bd33 -[IBDocumentAutolayoutManager _runAutolayoutCommandForArbitrationUnits:withBlock:] (in IDEInterfaceBuilderKit)
 23  0x000000011b6a2da5 -[IBDocumentAutolayoutManager updateAutolayoutStatusInArbitrationUnits:] (in IDEInterfaceBuilderKit)
 24  0x000000011b6a31c5 -[IBDocumentAutolayoutManager didFireAutolayoutStatusDelayedInvocation:] (in IDEInterfaceBuilderKit)
 25  0x000000010e22afc8 -[DVTDelayedInvocation runBlock:] (in DVTFoundation)
 26  0x000000010e22b53a -[DVTDelayedInvocation invokeIfNeeded] (in DVTFoundation)
 27  0x000000010e22bb17 -[DVTDelayedInvocation invoke] (in DVTFoundation)
 28  0x000000011b6a24ef -[IBDocumentAutolayoutManager autolayoutStatusForArbitrationUnitContainingObject:] (in IDEInterfaceBuilderKit)
 29  0x000000011b69ef36 -[IBDocumentAutolayoutManager isItemMisplaced:] (in IDEInterfaceBuilderKit)
 30  0x000000011b69f4f9 __61-[IBDocumentAutolayoutManager itemsWithCleanAutolayoutStatus]_block_invoke (in IDEInterfaceBuilderKit)
 31  0x0000000117f5bfde -[NSSet(IBSetAdditions) ib_setByFilteringUsingBlock:] (in IBFoundation)
 32  0x000000011b69f49e -[IBDocumentAutolayoutManager itemsWithCleanAutolayoutStatus] (in IDEInterfaceBuilderKit)
 33  0x000000011b6a3470 -[IBDocumentAutolayoutManager preserveCleanAutolayoutStatusDuring:] (in IDEInterfaceBuilderKit)
 34  0x000000011b6861e4 -[IBDocument preserveCleanAutolayoutStatusDuring:] (in IDEInterfaceBuilderKit)
 35  0x000000011b86ceec -[IBResourceManager synchronizeObjectPropertyValuesWithVariantContext] (in IDEInterfaceBuilderKit)
 36  0x000000011b86a400 __66-[IBResourceManager setupVariantContextWithContainerRepositories:]_block_invoke (in IDEInterfaceBuilderKit)
 37  0x000000010fb9452c -[IDEMediaResourceVariantContext registerVariantContextObserverWithOptions:block:] (in IDEKit)
 38  0x000000011b869fb2 -[IBResourceManager setupVariantContextWithContainerRepositories:] (in IDEInterfaceBuilderKit)
 39  0x000000011b86a557 -[IBResourceManager setResourceProvidingContainer:] (in IDEInterfaceBuilderKit)
 40  0x000000011b65ffda -[IBDocument setResourceProvidingContainer:] (in IDEInterfaceBuilderKit)
 41  0x000000011b65ec9d -[IBDocument refreshWorkspaceSourcedContent] (in IDEInterfaceBuilderKit)
 42  0x000000011b65ef63 -[IBDocument registerWorkspaceDocument:forEditorViewController:] (in IDEInterfaceBuilderKit)
 43  0x000000011b53b940 -[IBAbstractDocumentEditor viewDidInstall] (in IDEInterfaceBuilderKit)
 44  0x000000011b8c9355 -[IBStoryboardDocumentEditor viewDidInstall] (in IDEInterfaceBuilderKit)
 45  0x000000010ea565f8 -[DVTViewController _didInstallContentView:] (in DVTKit)
 46  0x000000010e842345 -[DVTControllerContentView _viewDidInstall] (in DVTKit)
 47  0x000000010e841be2 -[DVTControllerContentView viewDidMoveToWindow] (in DVTKit)
 48  0x00007fff97ceb33e -[NSView _setWindow:] (in AppKit)
 49  0x00007fff97cf605b -[NSView addSubview:] (in AppKit)
 50  0x00007fff97ea6533 -[NSView setSubviews:] (in AppKit)
 51  0x000000010e834ac8 -[DVTBorderedView setContentView:] (in DVTKit)
 52  0x000000010f59a2cd -[IDEEditorContext _setEditorView] (in IDEKit)
 53  0x000000010f7424e0 -[IDEEditorContext setupNewEditor:] (in IDEKit)
 54  0x000000010f743dc9 __91-[IDEEditorContext _openNavigableItem:documentExtension:document:shouldInstallEditorBlock:]_block_invoke (in IDEKit)
 55  0x000000010f5a976b -[IDEEditorContext _performBlockInsideReentrantGuard:] (in IDEKit)
 56  0x000000010f5a923b -[IDEEditorContext _openNavigableItem:documentExtension:document:shouldInstallEditorBlock:] (in IDEKit)
 57  0x000000010f5dba67 -[IDEEditorContext _openNavigableItem:withContentsOfURL:documentExtension:shouldInstallEditorBlock:] (in IDEKit)
 58  0x000000010f745698 -[IDEEditorContext _notifyDelegateAndOpenNavigableItem:withContentsURL:documentExtensionIdentifier:locationToSelect:annotationRepresentedObject:stateDictionary:annotationWantsIndicatorAnimation:exploreAnnotationRepresentedObject:highlightSelection:alwaysReplaceExistingNavigableItem:skipSubDocumentNavigationUnlessEditorIsReplaced:] (in IDEKit)
 59  0x000000010f61ae82 -[IDEEditorContext _notifyDelegateAndOpenEditorOpenSpecifier:updateHistory:] (in IDEKit)
 60  0x000000010f61a739 -[IDEEditorContext _openEditorOpenSpecifier:updateHistory:] (in IDEKit)
 61  0x000000010f61a59a -[IDEEditorContext openEditorOpenSpecifier:] (in IDEKit)
 62  0x000000010f61a480 -[IDEEditorModeViewController openEditorOpenSpecifier:editorContext:] (in IDEKit)
 63  0x000000010f61a2cc -[IDEEditorArea _openEditorOpenSpecifier:editorContext:takeFocus:] (in IDEKit)
 64  0x000000010f783756 __108+[IDEEditorCoordinator _doOpenEditorOpenSpecifier:forWorkspaceTabController:editorContext:target:takeFocus:]_block_invoke (in IDEKit)
 65  0x000000010f61a16d +[IDEEditorCoordinator _doOpenWithWorkspaceTabController:editorContext:target:allowFallback:documentURL:usingBlock:] (in IDEKit)
 66  0x000000010f619a39 +[IDEEditorCoordinator _doOpenEditorOpenSpecifier:forWorkspaceTabController:editorContext:target:takeFocus:] (in IDEKit)
 67  0x000000010f6195bf -[_IDEOpenRequest _runIfNecessary] (in IDEKit)
 68  0x00007fff9781efd8 __NSFireDelayedPerform (in Foundation)
 69  0x00007fff892da5d4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ (in CoreFoundation)
 70  0x00007fff892da263 __CFRunLoopDoTimer (in CoreFoundation)
 71  0x00007fff893571ba __CFRunLoopDoTimers (in CoreFoundation)
 72  0x00007fff89295e21 __CFRunLoopRun (in CoreFoundation)
 73  0x00007fff89295488 CFRunLoopRunSpecific (in CoreFoundation)
 74  0x00007fff96cdc701 RunCurrentEventLoopInMode (in HIToolbox)
 75  0x00007fff96cdc497 ReceiveNextEventCommon (in HIToolbox)
 76  0x00007fff96cdc2d7 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
 77  0x00007fff97d4469b _DPSNextEvent (in AppKit)
 78  0x00007fff981115d9 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
 79  0x000000010e9555fe -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
 80  0x00007fff97d3a54c -[NSApplication run] (in AppKit)
 81  0x00007fff97cbc6e2 NSApplicationMain (in AppKit)
 82  0x00007fff8d8f55ad start (in libdyld.dylib)

最佳答案

从您的日志来看,问题似乎出在这里:

*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <AVPlayerViewController 0x7c84ee00> for the key path "playerController.hasEnabledAudio" from <AVPlayerViewController 0x7c84ee00> because it is not registered as an observer.'
terminating with uncaught exception of type NSException

这是一篇涵盖该主题的帖子,您可能会觉得有帮助。

NSNotification removeObserver problem

更新

我不确定你的代码是什么样的,但控制台的输出告诉你问题出在哪里。为了找出问题所在,我会在崩溃之前放置一个断点。例如,如果您有一个与 UIButton 绑定(bind)的 IBAction,请放置一个断点并单步执行它以查看哪一行导致了问题。

在寻找答案方面,您会发现 Objective-C 是一条更常走的路。对于大多数事情,其语法与 Swift 非常相似,因此,如果您在 Objective-C 中找到了潜在的解决方案,那么您很可能能够拼凑出等效的 Swift 代码行。

您可能会发现这些“备忘单”很有帮助:

RW Swift Cheat Sheet

RW Objective-C Cheat Sheet

如果您可以隔离项目中有问题的函数/方法,您可能希望将其与崩溃时的控制台输出一起包含在您的问题中。

关于Xcode 7/Swift 2 Storyboard 崩溃 - Beta 1 和 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31658415/

相关文章:

ios - 委托(delegate)函数未在按钮单击时被调用

Swift 委托(delegate)协议(protocol)无法防止保留周期问题

ios - Swift 2 OAuth2 领英连接

ios - 通过蓝牙或在 iOS 中的本地 WiFi 网络之间进行点对点语音聊天

ios - XCode swift HTTPS : String(data: data! 编码:NSUTF8StringEncoding ) 返回 nil

ios - 新电脑上的 Xcode "valid signing identity not found"

ios - 如何使用 Swift 从 UIButton 函数停止另一个函数?

enums - 如何避免使用 Swift 2.0 枚举重复自己

objective-c - 如何防止 NSWindow 在 windowWillClose 方法上关闭?

ios - 使 Ipad 唯一的应用程序通用而无需重新提交