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

查看:17
本文介绍了在 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".

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

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.

Mike Ash 建议

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.

否则,解决此问题的唯一已知方法是重新启动用户 launchd.重新启动会做到这一点,但有一种不那么激烈/更快的方式.您需要创建另一个管理员用户,但您只需要做一次.当事情发生变化时,以您自己的身份注销,以该用户身份登录,然后杀死属于您的主要用户的 launchd,例如,

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.)

这个bug似乎在launchd中,当调试器停止调试而不杀死它时,它会继承app进程作为子进程.这通常是由应用程序变成僵尸,在 ps 中的进程状态为 Z 来表示的.

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.

核心问题似乎是在launchd 中实现的引导名称服务器中.这(就我的理解而言)将应用程序 ID 映射到 mach 端口.当该错误被触发时,该应用会终止,但不会从引导服务器的名称服务器映射中清除,因此引导服务器拒绝允许以相同名称注册该应用的另一个实例.

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() 可以解决问题,但事实并非如此.核心问题不是僵尸状态(这就是为什么有些僵尸是良性的),而是引导名称服务器,并且没有已知的方法可以清除这种缺少杀死 launchd 的情况.

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.

在您登录时杀死 launchd 会破坏您的会话.注销并重新登录不会杀死启动的用户;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.

我已向 Apple FWIW 提交了一个错误.rdar://10330930

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

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

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