就在最近,我在使用 XCode 时遇到了很多麻烦。每当我在模拟器上运行我的应用程序并崩溃(抛出异常或其他东西)时,模拟器会在我下次运行它时崩溃,即使我撤消了导致初始崩溃的代码。
例如,在一个初始化方法中,我调用
self = [super init];
return self;
我可以运行它一百次,而且每次都运行良好。但是如果我打电话
self = [super init];
[super wrlgnqelrguqrngouqerngerg];
return self;
然后它就应该崩溃了。但是如果我撤消随机消息调用,那么它又是
self = [super init];
return self;
然后我再次在模拟器上运行它,它崩溃了!即使我取消了导致崩溃的代码。当我点击运行时,它说 XCode 内部错误,当我点击显示详细信息时,它给我这个:
ASSERTION FAILURE in /SourceCache/IDEKit/IDEKit-303/Framework/Classes/Workspace/IDEWorkspaceTabController.m:2327
Details: Assertion failed: [suppressionTargetValue isEqualToString:_kUserDefaults_IDESuppressStopExecutionWarningTargetValue_Add]
Object: <IDEWorkspaceTabController: 0x201759bc0>
Method: -_showWarningForBuild:forOtherExecution:trackersToStop:taskActionBlock:
Thread: <NSThread: 0x2000217a0>{name = (null), num = 1}
Hints: None
Backtrace:
0 0x0000000100949773 -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in IDEKit)
1 0x000000010006d394 _DVTAssertionFailureHandler (in DVTFoundation)
2 0x0000000100931e02 -[IDEWorkspaceTabController _showWarningForBuild:forOtherExecution:trackersToStop:taskActionBlock:] (in IDEKit)
3 0x00000001008e830b -[IDEWorkspaceTabController _performContextTask:command:commandName:] (in IDEKit)
4 0x00007fff81fd7e9a -[NSApplication sendAction:to:from:] (in AppKit)
5 0x00000001001cf63c -[DVTApplication sendAction:to:from:] (in DVTKit)
6 0x000000010085b656 -[IDEApplication sendAction:to:from:] (in IDEKit)
7 0x00007fff81fd7e9a -[NSApplication sendAction:to:from:] (in AppKit)
8 0x00000001001cf63c -[DVTApplication sendAction:to:from:] (in DVTKit)
9 0x000000010085b656 -[IDEApplication sendAction:to:from:] (in IDEKit)
10 0x000000010031b9f3 -[DVTDelayedMenuButtonCell trackMouse:inRect:ofView:untilMouseUp:] (in DVTKit)
11 0x00007fff82062215 -[NSControl mouseDown:] (in AppKit)
12 0x00007fff81f7c34f -[NSWindow sendEvent:] (in AppKit)
13 0x00007fff81eb1a86 -[NSApplication sendEvent:] (in AppKit)
14 0x000000010085b36e -[IDEApplication sendEvent:] (in IDEKit)
15 0x00007fff81e484da -[NSApplication run] (in AppKit)
16 0x00007fff81e411a8 NSApplicationMain (in AppKit)
17 0x0000000100000eec
18 0x0000000000000002
然后我点击继续,模拟器启动,应用程序崩溃,我得到:
Couldn't register NI.nipod-app-final with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.
我已经尝试重新安装 XCode。没有帮助!
最佳答案
我通过删除我的首选项文件解决了这个问题。清理项目和模拟器没有用。我在用户名/库/首选项中找到了该文件。它被称为 com.apple.Xcode.plist。还有一些其他文件的名称中包含 Xcode。我删除了所有三个,重新启动 XCode,一切正常。我使用的是 XCode 4。
关于ios - XCode 需要在任何模拟器崩溃后重新启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6711048/