在iOS模拟器上测试时出错:无法向引导服务器注册 [英] Error when testing on iOS simulator: Couldn't register with the bootstrap server

查看:101
本文介绍了在iOS模拟器上测试时出错:无法向引导服务器注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击UIAlertView的按钮崩溃时,我正在模拟器上测试我的应用程序.我在那里停止调试,对代码进行了一些更改,然后再次构建了该应用程序.现在,当我运行该应用程序时,我在控制台中收到此错误

I was testing my app on the simulator when it crashed on clicking a button of a UIAlertView. I stopped debugging there, made some changes to the code and built the app again. Now when I run the application, I get this error in the console

无法在引导服务器上注册com.myApp.debug.错误:未知错误代码. 通常,这意味着该进程的另一个实例已在运行或挂在调试器中.程序收到信号:"SIGABRT".

Couldn't register com.myApp.debug 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.Program received signal: "SIGABRT".

我尝试从模拟器中删除该应用程序,进行了干净的构建,但在尝试运行该应用程序时仍然出现此错误.

I tried removing the app from the simulator, doing a clean build but I still get this error when I try to run the app.

我应该怎么做才能再次在模拟器上运行该应用程序?

What should I do to be able to run the app on my simulator again?

推荐答案

状态:这在Mac OS 10.8和Xcode 4.4上已经被发现.

status: this has been seen as recently as Mac OS 10.8 and Xcode 4.4.

tl; dr:这可能在两种情况下发生:在设备上运行时和在模拟器上运行时.在设备上运行时,断开并重新连接设备似乎可以解决问题.

tl;dr: This can occur in two contexts: when running on the device and when running on the simulator. When running on the device, disconnecting and reconnecting the device seems to fix things.

建议迈克·阿什

launchctl list|grep UIKitApplication|awk '{print $3}'|xargs launchctl remove

这并不总是有效.实际上,它对我从来没有用过,但在某些情况下显然可以使用.只是不知道哪种情况.因此值得尝试.

This doesn't work all the time. In fact, it's never worked for me but it clearly works in some cases. Just don't know which cases. So it's worth trying.

否则,解决此问题的唯一已知方法是重新启动用户启动.重新启动可以做到这一点,但是没有那么激烈/快速的方法.您将需要创建另一个管理员用户,但是只需执行一次即可.万一出现问题时,请以您自己的身份注销,以该用户身份登录,然后杀死属于您的主要用户的启动项,例如,

Otherwise, the only known way to fix this is to restart the user launchd. Rebooting will do that but there is a less drastic/faster way. You'll need to create another admin user, but you only have to do that once. When things wedge, log out as yourself, log in as that user, and kill the launchd that belongs to your main user, e.g.,

sudo kill -9 `ps aux | egrep 'user_id .*[0-9] /sbin/launchd' | awk '{print $2}'`

用您的主要用户名替换user_id.以普通用户的身份再次登录,使您回到理智的状态.有点痛苦,但要比完全重新启动少.

substituting your main user name for user_id. Logging in again as your normal user gets you back to a sane state. Kinda painful, but less so than a full reboot.

详细信息:

在Lion/Xcode 4.2中,这种情况开始经常发生. (就我个人而言,在组合之前我从未见过.)

This has started happening more often with Lion/Xcode 4.2. (Personally, I never saw it before that combination.)

该错误似乎已启动,该错误在调试器停止调试而不杀死它时以子代的形式继承应用程序进程.这通常是因为该应用变成了僵尸,进程状态为ps(以ps为单位).

The bug seems to be in launchd, which inherits the app process as a child when the debugger stops debugging it without killing it. This is usually signaled by the app becoming a zombie, having a process status of Z in ps.

核心问题似乎在启动中实现的引导程序名称服务器中.这(据我所知)将应用程序ID映射到马赫端口.触发该错误后,该应用程序死亡,但没有从引导服务器的名称服务器映射中清除,因此,引导服务器拒绝允许以相同名称注册该应用程序的另一个实例.

The core issue appears to be in the bootstrap name server which is implemented in launchd. This (to the extent I understand it) maps app ids to mach ports. When the bug is triggered, the app dies but doesn't get cleaned out of the bootstrap server's name server map and as result, the bootstrap server refuses to allow another instance of the app to be registered under the same name.

希望(参见注释)强迫僵尸启动到wait()可以解决问题,但不能解决.核心问题不是僵尸状态(这就是为什么某些僵尸是良性的),而是引导程序名称服务器,没有已知的方法可以消除这种发动的杀戮.

It was hoped (see the comments) that forcing launchd to wait() for the zombie would fix things but it doesn't. It's not the zombie status that's the core problem (which is why some zombies are benign) but the bootstrap name server and there's no known way to clear this short of killing launchd.

该错误似乎是由Xcode,gdb和用户启动之间的错误触发的.我只是通过在iphone模拟器中运行一个应用程序,使其停止在gdb中,然后进行构建并运行到ipad模拟器来重复执行该操作.它似乎对切换模拟器(iOS 4.3/iOS 5,iPad/iPhone)敏感.当我频繁切换模拟器时,这种情况并非一直发生,而是相当频繁地发生.

It looks like the bug is triggered by something bad between Xcode, gdb, and the user launchd. I just repeated the wedge by running an app in the iphone simulator, having it stopped within gdb, and then doing a build and run to the ipad simulator. It seems to be sensitive to switching simulators (iOS 4.3/iOS 5, iPad/iPhone). It doesn't happen all the time but fairly frequently when I'm switching simulators a lot.

您登录后启动的杀戮将会破坏您的会话.注销并重新登录不会杀死启动的用户; OS X使现有流程保持不变.重新启动将解决问题,但这很痛苦.上面的说明速度更快.

Killing launchd while you're logged in will screw up your session. Logging out and logging back in doesn't kill the user launchd; OS X keeps the existing process around. A reboot will fix things, but that's painful. The instructions above are faster.

我已向FWIW苹果公司提交了一个错误. rdar://10330930

I've submitted a bug to Apple, FWIW. rdar://10330930

这篇关于在iOS模拟器上测试时出错:无法向引导服务器注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆