Xcode在打开新项目后立即崩溃

时间:2020-04-05 21:54:56

标签: xcode

$ 14:51:33 /Applications/Xcode.app/Contents/MacOS/Xcode
2020-04-05 14:51:44.095 Xcode[5709:184457] -[__NSCFNumber hasPrefix:]: unrecognized selector sent to instance 0xed1bd6c1b1e0a897
2020-04-05 14:51:44.099 Xcode[5709:184457] [MT] DVTAssertions: UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[__NSCFNumber hasPrefix:]: unrecognized selector sent to instance 0xed1bd6c1b1e0a897
UserInfo: (null)
Hints:
  0: Sending newProject: to IDEApplicationCommands from (null)
  1: Sending openNewProjectAssistant: to IDEWelcomeWindowController from <IDEWelcomeWindowHighlightButton: 0x7fbc46da41b0>
2020-04-05 14:51:44.116 Xcode[5709:184457] [MT] DVTAssertions:
Backtrace:
  0   __exceptionPreprocess (in CoreFoundation)
  1   DVTFailureHintExceptionPreprocessor (in DVTFoundation)
  2   objc_exception_throw (in libobjc.A.dylib)
  3   -[NSObject(NSObject) __retain_OA] (in CoreFoundation)
  4   ___forwarding___ (in CoreFoundation)
  5   _CF_forwarding_prep_0 (in CoreFoundation)
  6   __68-[IDEWorkspaceWindowController _purgeOldIdentifiersFromUserDefaults]_block_invoke_2 (in IDEKit)
  7   __68-[IDEWorkspaceWindowController _purgeOldIdentifiersFromUserDefaults]_block_invoke (in IDEKit)
  8   _dispatch_client_callout (in libdispatch.dylib)
  9   _dispatch_once_callout (in libdispatch.dylib)
 10   -[IDEWorkspaceWindowController _purgeOldIdentifiersFromUserDefaults] (in IDEKit)
 11   -[IDEWorkspaceWindowController windowDidLoad] (in IDEKit)
 12   -[NSWindowController _windowDidLoad] (in AppKit)
 13   -[NSWindowController window] (in AppKit)
 14   -[IDEDocumentController _openUntitledWorkspaceDocumentAndDisplay:simpleFilesFocused:forSingleFile:editorDocumentURLOrNil:error:] (in IDEKit)
 15   -[IDEApplicationCommands newTemplateForTemplateKind:template:] (in IDEKit)
 16   -[IDEApplicationCommands newProject:] (in IDEKit)
 17   -[NSApplication(NSResponder) sendAction:to:from:] (in AppKit)
 18   __37-[DVTApplication sendAction:to:from:]_block_invoke.86 (in DVTKit)
 19   DVTInvokeWithFailureHint (in DVTFoundation)
 20   -[DVTApplication sendAction:to:from:] (in DVTKit)
 21   +[IDECommandManager sendActionForCommandWithIdentifier:from:] (in IDEKit)
 22   -[NSApplication(NSResponder) sendAction:to:from:] (in AppKit)
 23   __37-[DVTApplication sendAction:to:from:]_block_invoke.86 (in DVTKit)
 24   DVTInvokeWithFailureHint (in DVTFoundation)
 25   -[DVTApplication sendAction:to:from:] (in DVTKit)
 26   -[NSControl sendAction:to:] (in AppKit)
 27   __26-[NSCell _sendActionFrom:]_block_invoke (in AppKit)
 28   -[NSCell _sendActionFrom:] (in AppKit)
 29   -[NSButtonCell _sendActionFrom:] (in AppKit)
 30   NSControlTrackMouse (in AppKit)
 31   -[NSCell trackMouse:inRect:ofView:untilMouseUp:] (in AppKit)
 32   -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] (in AppKit)
 33   -[NSControl mouseDown:] (in AppKit)
 34   -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] (in AppKit)
 35   -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] (in AppKit)
 36   -[NSWindow(NSEventRouting) sendEvent:] (in AppKit)
 37   -[NSApplication(NSEvent) sendEvent:] (in AppKit)
 38   -[IDEApplication sendEvent:] (in IDEKit)
 39   -[NSApplication run] (in AppKit)
 40   NSApplicationMain (in AppKit)
 41   main (in Xcode)
 42   start (in libdyld.dylib)
Abort trap: 6

这是我第一次在MacbookPro上安装XCode

我正在使用macOS Catalin版本10.15.4

我尝试过的

  • 安装不同版本的Xcode:11.4、11.3、10.1
  • sudo rm -rf /Library/Developer/CommandLineTools && xcode-select --install
  • sudo xcodebuild -license
  • 删除〜/ Library / Caches
  • 删除/ Library / Caches
  • 删除〜/ Library / Developer
  • defaults delete com.apple.dt.xcode

4 个答案:

答案 0 :(得分:0)

尝试删除〜/ Library / Developer / Xcode中的DerivedData目录

尝试卸载Xcode,然后重新安装

答案 1 :(得分:0)

看起来您的默认设置可能有问题。 尝试运行以下命令清除它们

defaults delete com.apple.dt.xcode

答案 2 :(得分:0)

最有可能在代码中的某个地方,将NSNumber变量分配给NSString变量。
因此,数字对象(实例0xed1bd6c1b1e0a897)无法响应hasPrefix: method

2020-04-05 14:51:44.095 Xcode[5709:184457] -[__NSCFNumber hasPrefix:]: unrecognized selector sent to instance 0xed1bd6c1b1e0a897

尝试调试并弄清楚该对象实际上是0xed1bd6c1b1e0a897,在哪里创建并分配给字符串对象。 找到它后-您可以使用NSString property轻松地将其转换为stringValue

我认为您能够构建该项目。如果Xcode在构建和运行之前就崩溃了-我不知道。

答案 3 :(得分:0)

尝试删除所有这些文件夹吗?

~/Library/Containers/com.apple.dt.BitbucketHostBuiltInExtension
~/Library/Containers/com.apple.dt.BitbucketServerHostBuiltInExtension
~/Library/Containers/com.apple.dt.GitHubEnterpriseHostBuiltInExtension
~/Library/Containers/com.apple.dt.GitHubHostBuiltInExtension
~/Library/Containers/com.apple.dt.GitLabHostBuiltInExtension
~/Library/Containers/com.apple.dt.GitLabSelfHostBuiltInExtension
~/Library/Containers/com.apple.dt.IDECacheDeleteAppExtension
~/Library/Containers/com.apple.dt.XCDocumenter.XCDocumenterExtension
~/Library/Containers/com.apple.dt.XcodeBuiltInExtensions

~/Library/Preferences/com.apple.dt.Instruments.plist
~/Library/Preferences/com.apple.dt.SKAgent.plist
~/Library/Preferences/com.apple.dt.Xcode.ITunesSoftwareService.plist
~/Library/Preferences/com.apple.dt.Xcode.LSSharedFileList.plist
~/Library/Preferences/com.apple.dt.Xcode.Playground.plist
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/Preferences/com.apple.dt.xcodebuild.plist