Xcode 7 / Swift 2 故事板崩溃 - Beta 1 和 4

Xcode 7 / Swift 2 Storyboard crash - Beta 1 & 4

在没有警告的情况下,我的 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(我有)中对我来说崩溃了。我真的需要一些帮助。

UPDATE 此错误消息也出现在警告通知中: 由于缺少入口点,场景无法访问,并且没有通过 -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

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

NSNotification removeObserver problem

更新

我不确定您的代码是什么样子,但控制台的输出告诉您问题出在哪里。就找出问题所在而言,我会在崩溃前放置一个断点。例如,如果您将 IBAction 绑定到 UIButton,请在其中放置一个断点并单步执行以查看导致问题的行。

在寻找答案方面,您会发现 Objective-C 是人迹罕至的道路。对于大多数事情,语法与 Swift 非常相似,因此如果您在 Objective-C 中找到潜在的解决方案,您很可能能够拼凑出等效的 Swift 行。

您可能会发现这些 "cheat sheets" 有帮助:

RW Swift Cheat Sheet

RW Objective-C Cheat Sheet

如果您可以在您的项目中找出有问题的 function/method,您可能希望将其与崩溃时的控制台输出一起包含在您的问题中。