我有一个编译并运行良好的XCode项目,但是当我向特定XIB的UI添加元素时,当我尝试保存或XCode失去焦点时,它会崩溃XCode。查看崩溃的错误数据似乎是与NSTableHeader相关的断言失败,但我不知道从那里去哪里?我没有使用自动布局,这是一个OSX应用程序。
Process: Xcode [2505]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 7.3.1 (10188.1)
Build Info: IDEFrameworks-10188001000000000~3
App Item ID: 497799835
App External ID: 817226719
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [2505]
User ID: 501
Date/Time: 2016-06-14 11:30:04.824 -0700
OS Version: Mac OS X 10.11.5 (15F34)
Report Version: 11
Anonymous UUID: 20048F22-546D-D351-6F8C-D73FF28F4650
Time Awake Since Boot: 67000 seconds
System Integrity Protection: enabled
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: 7D1014
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilder/IDEInterfaceBuilder-10117/InterfaceBuilderKit/Document/ObjectContainer/IBObjectContainer.m:513
Details: Can't get the OID of an object not in the document: <NSTableHeaderView: 0x7fc5daeefd90>
Object: <IBObjectContainer: 0x7fc5dae4eeb0>
Method: -objectIDForObject:
Thread: <NSThread: 0x7fc5d3e17e80>{number = 1, name = main}
Hints: None
Backtrace:
0 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in IDEKit)
1 _DVTAssertionHandler (in DVTFoundation)
2 _DVTAssertionFailureHandler (in DVTFoundation)
3 -[IBObjectContainer objectIDForObject:] (in IDEInterfaceBuilderKit)
4 -[IBDocument objectIDForObject:] (in IDEInterfaceBuilderKit)
5 -[IBDocument documentArchiver:referenceIDForObject:referenceType:] (in IDEInterfaceBuilderKit)
6 -[IBDocumentArchiver referenceIDForObject:withReferenceType:] (in IDEInterfaceBuilderKit)
7 -[IBDocumentArchiver archiveObjectReference:referenceType:forKey:] (in IDEInterfaceBuilderKit)
8 -[IBDocumentArchiver archiveObjectReference:referenceType:forKey:defaultValue:] (in IDEInterfaceBuilderKit)
9 -[NSTableView(IBDocumentArchivingGenerator) archiveWithDocumentArchiver:] (in IDEInterfaceBuilderCocoaIntegration)
10 __51-[IBDocumentArchiver archiveObject:forOptionalKey:]_block_invoke (in IDEInterfaceBuilderKit)
11 -[IBDocumentArchiver recurseWithElementNamed:forObject:kind:invokingBlock:] (in IDEInterfaceBuilderKit)
12 -[IBDocumentArchiver archiveObject:forOptionalKey:] (in IDEInterfaceBuilderKit)
13 __59-[IBDocumentArchiver archiveArray:withName:forOptionalKey:]_block_invoke (in IDEInterfaceBuilderKit)
14 -[IBDocumentArchiver recurseWithElementNamed:forObject:kind:invokingBlock:] (in IDEInterfaceBuilderKit)
15 -[IBDocumentArchiver archiveArray:withName:forOptionalKey:] (in IDEInterfaceBuilderKit)
16 -[IBDocumentArchiver archiveArray:withName:forOptionalKey:defaultValue:] (in IDEInterfaceBuilderKit)
17 -[NSView(IBViewIntegration) ibArchiveSubviews:] (in IDEInterfaceBuilderKit)
18 -[NSView(IBDocumentArchivingGenerator) archiveWithDocumentArchiver:] (in IDEInterfaceBuilderKit)
19 -[IBNSCustomView(IBDocumentArchivingGenerator) archiveWithDocumentArchiver:] (in IDEInterfaceBuilderCocoaIntegration)
20 __51-[IBDocumentArchiver archiveObject:forOptionalKey:]_block_invoke (in IDEInterfaceBuilderKit)
21 -[IBDocumentArchiver recurseWithElementNamed:forObject:kind:invokingBlock:] (in IDEInterfaceBuilderKit)
22 -[IBDocumentArchiver archiveObject:forOptionalKey:] (in IDEInterfaceBuilderKit)
23 __59-[IBDocumentArchiver archiveArray:withName:forOptionalKey:]_block_invoke (in IDEInterfaceBuilderKit)
24 -[IBDocumentArchiver recurseWithElementNamed:forObject:kind:invokingBlock:] (in IDEInterfaceBuilderKit)
25 -[IBDocumentArchiver archiveArray:withName:forOptionalKey:] (in IDEInterfaceBuilderKit)
26 -[IBDocument archiveTopLevelObjects:] (in IDEInterfaceBuilderKit)
27 -[IBDocument archiveAndVerifyArchivingOfTopLevelObjects:] (in IDEInterfaceBuilderKit)
28 -[IBDocument archivePlatformIndependentDataWithDocumentArchiver:] (in IDEInterfaceBuilderKit)
29 -[IBDocument archiveDocument:] (in IDEInterfaceBuilderKit)
30 -[IBDocumentArchiver recurseWithElementNamed:forObject:kind:invokingBlock:] (in IDEInterfaceBuilderKit)
31 -[IBDocumentArchiver archiveDocument:withType:compatibilityVersion:] (in IDEInterfaceBuilderKit)
32 -[IBDocumentArchiver dataFromArchiveDocument:withType:compatibilityVersion:] (in IDEInterfaceBuilderKit)
33 __46-[IBDocument fileWrapperOfType:options:error:]_block_invoke (in IDEInterfaceBuilderKit)
34 -[IBDocument fileWrapperOfType:options:error:] (in IDEInterfaceBuilderKit)
35 -[IBDocument fileWrapperOfType:error:] (in IDEInterfaceBuilderKit)
36 -[NSDocument writeToURL:ofType:error:] (in AppKit)
37 -[IBDocument writeToURL:ofType:error:] (in IDEInterfaceBuilderKit)
38 -[NSDocument writeToURL:ofType:forSaveOperation:originalContentsURL:error:] (in AppKit)
39 -[IBDocument writeToURL:ofType:forSaveOperation:originalContentsURL:error:] (in IDEInterfaceBuilderKit)
40 -[NSDocument _writeSafelyToURL:ofType:forSaveOperation:forceTemporaryDirectory:error:] (in AppKit)
41 -[NSDocument _writeSafelyToURL:ofType:forSaveOperation:error:] (in AppKit)
42 -[NSDocument writeSafelyToURL:ofType:forSaveOperation:error:] (in AppKit)
43 -[IDEEditorDocument writeSafelyToURL:ofType:forSaveOperation:error:] (in IDEKit)
44 __66-[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke_22463 (in AppKit)
45 __66-[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke2460 (in AppKit)
46 __66-[NSDocument saveToURL:ofType:forSaveOperation:completionHandler:]_block_invoke_22313 (in AppKit)
47 __50-[IDEEditorDocument continueFileAccessUsingBlock:]_block_invoke.74 (in IDEKit)
48 -[NSDocument continueFileAccessUsingBlock:] (in AppKit)
49 -[IDEEditorDocument continueFileAccessUsingBlock:] (in IDEKit)
50 __101-[NSDocument _fileCoordinator:asynchronouslyCoordinateReadingContentsAndWritingItemAtURL:byAccessor:]_block_invoke_2 (in AppKit)
51 __68-[IDEEditorDocument continueAsynchronousWorkOnMainThreadUsingBlock:]_block_invoke (in IDEKit)
52 __62-[NSDocumentController(NSInternal) _onMainThreadInvokeWorker:]_block_invoke2079 (in AppKit)
53 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ (in CoreFoundation)
54 __CFRunLoopDoBlocks (in CoreFoundation)
55 __CFRunLoopRun (in CoreFoundation)
56 CFRunLoopRunSpecific (in CoreFoundation)
57 RunCurrentEventLoopInMode (in HIToolbox)
58 ReceiveNextEventCommon (in HIToolbox)
59 _BlockUntilNextEventMatchingListInModeWithFilter (in HIToolbox)
60 _DPSNextEvent (in AppKit)
61 -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] (in AppKit)
62 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (in DVTKit)
63 -[NSApplication run] (in AppKit)
64 NSApplicationMain (in AppKit)
65 0x000000010c51a39b (in Xcode)
66 start (in libdyld.dylib)
abort() called
答案 0 :(得分:1)
我遇到了类似的问题,我认为这是因为我的XIB文件非常陈旧(来自XCode 4.6或更早版本)。从那时起,xml-schema发生了重大变化。 (参见this article。)我能够通过从Time Machine钓鱼XCode 6并在应用程序中与XCode 7一起复制来更改我需要做的XIB。我没有尝试使用XCode 6打开任何项目,但我直接打开了XIB并进行了我需要在项目之外进行的更改。
奇怪的是,我几周前才能修改其中一个XIB文件。然后XCode(7)用新模式完全重写了XML,现在编辑XIB没有问题。此外,如果我尝试将XIB升级到更新的架构,即使XCode 6也会崩溃。 (我想我只能编辑我的XIB,因为与XCode 7不同,XCode 6仍然可以在不升级的情况下编辑旧架构。)
我认为Apple可能在过去几周内引入了XCode外部的软件更新,但仍然破坏了xml升级。或者我做过的其他事情做到了,但我想不出它会是什么。
FWIW:我在10.11.5,所以至少XCode 6的Interface Builder部分仍然适用于最新的操作系统。
编辑:我能够升级XML,因此可以使用稍微复杂的解决方案在XCode 7.3.1中编辑XIB: