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
我正在模拟器上测试我的应用程序,当它点击一个UIAlertView的按钮时。我停止了那里的调试,对代码做了一些修改,重新构建了应用程序。现在,当我运行应用程序时,我在控制台上得到这个错误。
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”.
无法向引导服务器注册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?
我该怎么做才能在模拟器上运行应用程序?
31 个解决方案
#1
160
Try quitting and restarting the simulator? If "worse comes to worst" you can always try restarting: in my experience this should fix it.
尝试退出并重新启动模拟器?如果“最糟糕的事情来了”,你可以试着重新开始:根据我的经验,这应该能解决它。
#2
242
status: this has been seen as recently as Mac OS 10.8 and Xcode 4.4.
状态:这是最近的Mac OS 10.8和Xcode 4.4。
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.,
否则,唯一已知的修复方法是重新启动用户launchd。重新引导可以做到这一点,但是有一种不太激烈/更快的方法。您将需要创建另一个admin用户,但您只需要创建一次。当事情偏离正轨时,以你自己的身份登入,以那个用户的身份登入,并终止属于你的主要用户的发射,例如,
sudo kill -9 `ps aux | egrep 'user_id .*[0-9] /sbin/launchd' | awk '{print $2}'`
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.
用用户名替换user_id。再次登录,作为您的正常用户让您回到正常状态。有点痛苦,但还不如完全重启。
details:
细节:
This has started happening more often with Lion/Xcode 4.2. (Personally, I never saw it before that combination.)
在Lion/Xcode 4.2中,这种情况开始发生得更频繁。(就我个人而言,我从未见过这种组合。)
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.
这个bug似乎出现在launchd中,当调试器停止调试时,它将把应用程序进程继承为子进程,而不会杀死它。这通常是应用程序变成僵尸的信号,在ps中有Z的进程状态。
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.
核心问题出现在bootstrap名称服务器中,该服务器在launchd中实现。这(在我理解的范围内)将应用程序id映射到mach端口。当这个bug被触发时,该应用程序就会死,但不会从引导服务器的名称服务器映射中清除,因此,引导服务器拒绝允许以相同的名称注册该应用程序的另一个实例。
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.
人们希望(看到评论)迫使launchd等待僵尸来解决问题,但事实并非如此。不是僵尸状态才是核心问题(这就是为什么有些僵尸是良性的),而是引导名称服务器,而且没有任何已知的方法可以清除这种短杀启动。
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.
看起来这个bug是由Xcode、gdb和用户launchd之间的错误触发的。我在iphone模拟器中运行了一个应用程序,让它在gdb中停止,然后进行构建并运行到ipad模拟器中。它似乎对切换模拟器很敏感(iOS 4.3/iOS 5、iPad/iPhone)。它不会一直发生,但当我频繁地切换模拟器时,它会发生得很频繁。
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.
在登录时杀死launchd会使您的会话陷入混乱。退出和返回登录不会杀死用户launchd;OS X保留了现有的进程。重启会修复问题,但这很痛苦。上面的说明更快。
I've submitted a bug to Apple, FWIW. rdar://10330930
我向苹果提交了一个错误,FWIW。rdar:/ / 10330930
#3
70
I find I have started having this issue with Lion + Xcode 4.2. I have also experienced the issue in Xcode 4.3.
我发现我已经开始在Lion + Xcode 4.2中遇到这个问题。我在Xcode 4.3中也遇到过这个问题。
I have tried all the suggestions but none of them have worked other than a full reboot.
我已经尝试了所有的建议,但除了完全重新启动之外,没有一个是有效的。
Here is how you determine if you require a reboot quickly.
以下是您如何确定是否需要快速重启。
List out all your Zombie processes:
列出你所有的僵尸程序:
ps -el | grep 'Z'
If you see your app listed as a Zombie process you will need to reboot your machine. The error message states "This generally means that another instance of this process was already running or is hung in the debugger". Well, Xcode is detecting this Zombie process which you can't kill. The only way you can then fix it is with a system reboot. :(
如果你看到你的应用程序被列为僵尸进程,你需要重新启动你的机器。错误消息声明“这通常意味着该进程的另一个实例已经在运行或挂起在调试器中”。Xcode发现了这个僵尸进程你无法杀死它。只有通过系统重新启动才能修复它。:(
EDIT, 20120823: I have some better knowledge of Zombie processes so I wanted to update this answer. A Zombie process is created when a parent process does not call wait() (wait for process to change state) on a terminating child process. You can't run 'kill' directly on a Zombie process but if you kill the parent process, the zombie child process will be 'reaped' and removed from the process table.
编辑,20120823:我对僵尸进程有了更好的了解,所以我想更新这个答案。当父进程在终止子进程中不调用wait()(等待进程更改状态)时,将创建一个僵尸进程。不能直接在僵尸进程上运行“kill”,但是如果您杀死了父进程,那么僵尸子进程将被“回收”并从进程表中删除。
I haven't seen this issue in a long while so haven't inspected to see what the parent process is in this scenario. The alternative to killing the parent process is to reboot your system. :)
我已经很久没有看到这个问题了,所以还没有检查父进程在这个场景中是什么。杀死父进程的替代方法是重新启动系统。:)
#4
20
I just had this happen to me: I was getting the error only on my device and the simulator was working fine. I ended up having to reset my device and the error went away.
我遇到了这样的情况:我只能在我的设备上得到错误,而且模拟器运行良好。我不得不重新设置我的设备,错误消失了。
#5
15
I'm having this problem very often recently. What would prevent this from occurring? Logging out and in fixes the problem but.. it's annoying to do so every so often.
最近我经常遇到这个问题。怎样才能防止这种情况发生呢?退出并进入修复问题,但是。经常这样做很烦人。
EDIT:
编辑:
I just found the cause. I had a bug in ApplicationWillTerminate method. So when i click stop button on Xcode window, app couldn't properly terminate and started to hang.
我刚找到原因。我在申请中有一个错误。所以当我点击Xcode窗口上的stop按钮时,app无法正常终止并开始挂起。
check Activity Monitor to see if your app is on the list. force quit if possible.
检查活动监视器,看看你的应用是否在列表中。“强制关闭”如果可能的话。
#6
14
If you find your problem is due to zombie processes:
如果你发现你的问题是由于僵尸程序:
ps -el | grep 'Z'(as in the earlier comment https://*.com/a/8104400/464289) and just want to fix the problem immediately, you can do so without rebooting or killing anything. Just rename your project target executable:
- Click on the project on the left-hand pane
- 单击左边窗格上的项目
- Select Build Settings in the middle pane
- 在中间窗格中选择Build设置
- Under 'Packaging' change 'Product Name' from $(TARGET_NAME) to $(TARGET_NAME).1
- 在“打包”下,将“产品名称”从$(TARGET_NAME)更改为$(TARGET_NAME).1
Easy!
简单!
#7
7
Well, no answers but at least one more test to make. Open Terminal and run this command: "ps-Ael | grep Z". If you get two entries, one "(clang)" and the other your app or company name, you're hosed - reboot.
好吧,没有答案,但至少再做一个测试。打开终端,运行以下命令:“ps-Ael | grep Z”。如果你得到两个条目,一个是“(铿锵)”,另一个是你的应用程序或公司名称,你就会被踢-重启。
If you are a developer, enter a short bug and tell Apple how absolutely annoying having to reboot is, and mention they can dup this bug to "rdar://10401934" which I just entered.
如果你是一名开发人员,输入一个简短的bug,告诉苹果必须重新启动是多么烦人,并告诉他们可以把这个bug复制到我刚刚输入的“rdar:/ 10401934”。
David
大卫
#8
5
Resetting the iOS Simulator fixed the error for me. Although this will remove all of the Apps you have in Simulator, it fixes the problem without having to restart the machine.
重置iOS模拟器为我修正了错误。尽管这将删除模拟器中的所有应用程序,但它无需重新启动机器就能修复问题。
You can reset your iOS Simulator by doing the following:
您可以通过以下操作重置您的iOS模拟器:
1) Go to the "iOS Simulator" menu, next to the Apple () logo on the far left of your main screen.
2) Select "Reset Content and Settings...".
3) Read the pop message and if you agree click "Reset" otherwise, click "Don't Reset".
1)“iOS模拟器”菜单,旁边的苹果()标志您的主屏幕左边。2)选择“重置内容和设置…”。3)阅读pop消息,如果你同意点击“重置”,否则点击“不重置”。
#9
4
I had the problem @jyap mentions with zombie processes. The only way to clear them was to reboot. However, I noticed that my friends working on the same project would get the same issue but could kill the simulator without creating a zombie process. I completely uninstalled Xcode and re-installed it, and while I still get the error, it doesn't create zombie processes, so I don't have to reboot.
我遇到了@jyap提到的僵尸进程的问题。清除它们的唯一方法是重启。然而,我注意到我的朋友们在同一个项目上也会遇到同样的问题,但是可以在不创建僵尸程序的情况下杀死模拟器。我完全卸载了Xcode并重新安装了它,虽然我仍然得到错误,但它没有创建僵尸进程,所以我不必重新启动。
Before I did that, I was using this really ugly workaround: change your app ID and run again. You end up with junk copies of the app in the simulator, but you can put off rebooting for a while.
在此之前,我使用了一个非常糟糕的解决方案:更改应用程序ID并再次运行。你最终会在模拟器中看到垃圾版本的应用,但你可以推迟重启一段时间。
#10
4
This error happens a lot to me, almost every time I test the app in the Simulator, forcing me to restart.
这个错误经常发生在我身上,几乎每次我在模拟器中测试应用程序时,都迫使我重新启动。
Here's a workaround if you want to get some work done:
如果你想完成一些工作,这里有一个变通的办法:
- Click your project in the Project navigator
- 在项目导航器中单击项目
- Go Target -> Info
- 目标- >信息
- Add a key for Application does not run in background and set to
YES
. - 为应用程序添加一个关键字,不能在后台运行,并设置为YES。
This will mean that when you press the home button in the simulator or quit the simulator, the app doesn't hang.
这意味着当你在模拟器中按home键或退出模拟器时,应用程序不会挂起。
Don't forget to change this setting back before distribution! Put it on your release checklist :)
不要忘记在分发之前更改此设置!把它写在你的发布清单上:)
#11
4
If this happens when testing on the iPhone. Just restart the phone. From what I have been told the phone or simulator still believes there is an instance of the app running, so when it was last run it had not terminated correctly do to either an error in your code or the phone/simulator just wanted to have a moan.
如果在iPhone上测试时发生这种情况。只是重新启动手机。据我所知,手机或模拟器仍然相信有一个应用程序实例在运行,所以当它最后一次运行时,它并没有正确地终止你的代码中的错误,或者手机/模拟器只是想发出呻吟。
#12
4
I got this error while debugging my app on an iPhone 4. Hard rebooting the iPhone solved my problem. (Powering off the iPhone hung...)
我在iPhone 4上调试我的应用程序时犯了这个错误。重新启动iPhone解决了我的问题。(切断iPhone的电源……)
I did not have any zombie process on my mac and rebooting the mac did not solve the problem.
我的mac上没有任何僵尸进程,重新启动mac也不能解决问题。
Maybe this bug can manifest itself on both the simulator and actual devices???
也许这个bug可以在模拟器和实际设备上显示出来?
#13
4
Restarted the Device, Worked! :D
重启设备,工作!:D
Thanks Everyone for the great suggestions.
谢谢大家的建议。
#14
3
I just had this error. I tried restarting the simulator and Xcode but my project would only work again after a clean and build. No idea what caused it.
我刚犯了这个错误。我尝试重新启动模拟器和Xcode,但我的项目只有在经过干净和构建之后才能再次运行。不知道是什么引起的。
#15
3
I had a recursive setter that blew through the stack and killed my app in such a way that I had to power boot my iPad. It was provable with a fix in the code.
我有一个递归setter,它在栈中爆掉了我的应用程序,我不得不启动我的iPad。可以用代码中的修正来验证它。
#16
3
- Close simulator
- 关闭模拟器
- Stop the app from running in xCode.
- 停止应用程序在xCode中运行。
- Open Activity Monitor and search for a process running with your App NAME.
- 打开活动监视器并搜索一个进程运行与您的应用程序名称。
- Kill this process in Activity Monitor
- 在活动监视器中关闭此进程
- Rebuild your project and you should be all set
- 重新构建您的项目,您应该已经准备好了
#17
3
I had same problem and solved it by doing the following
我有同样的问题,通过下面的方法解决了这个问题。
- Deleting the app from the device,
- 从设备中删除app,
- Disconnecting the device from Mac,
- 断开设备与Mac的连接,
- Turning the device off and back on,
- 把设备关了又开,
- Quitting and relaunching Xcode,
- 戒烟和重振Xcode,
- Quitting Instruments,
- 戒烟工具,
- Finally, Clean and Build again.
- 最后,再次清洁和重建。
I also did one more thing, because Xcode is configured to use iOS 5.0 and my project uses iOS 4.3
我还做了一件事,因为Xcode被配置为使用iOS 5.0,我的项目使用iOS 4.3
- Remove all frameworks and add them again.
- 删除所有框架并再次添加它们。
#18
3
Alternate workaround:
备选解决方案:
- Give your app a new identifier. If it's called com.foobar.myapp, call it com.foobar.myapp01
- 给你的应用一个新的标识符。如果这叫做com.foobar。myapp,称之为com.foobar.myapp01
You lose all data in the app as it's actually a new app running as far as the iPhone simulator is concerned. This may or may not be more annoying than rebooting - just wanted to add it to the list.
你会丢失应用中的所有数据,因为它实际上是一个运行在iPhone模拟器上的新应用。这可能比重新启动更烦人,也可能不是更烦人——只是想把它添加到列表中。
#19
3
The Cause
的原因
Running your app in the Simulator before the previously running app has completely stopped.
在先前运行的应用程序完全停止之前,在模拟器中运行你的应用程序。
The Fix
修复
Wait until you see the Stop button become active again before running again.
在再次运行之前,请等待看到停止按钮再次激活。
(I'm using Xcode 4.2.1. This problem happened very frequently when I upgraded to OS X Lion).
(我使用Xcode 4.2.1。准备当我升级到OS X Lion时,这个问题经常发生。
#20
2
Fixed by rebooting my phone after deleting the app, then rebuilding it clean and running again. Works fine now.
修正了在删除应用程序后重新启动手机,然后重新构建它并重新运行。工作好了。
Weird.
奇怪。
#21
2
No rebuild or reinstall needed for my issue, and in my case the error appeared when trying to run the app on the iPhone. Simulator worked fine.
我的问题不需要重新构建或重新安装,在我的例子中,当我试图在iPhone上运行应用程序时出现了错误。模拟器运行良好。
Solution: Delete app off phone, do a cold restart of phone and now all is well.
解决方案:删除手机应用,冷重启手机,现在一切都好了。
#22
2
Happened a lot for me with Xcode 4.2.1 on Lion. Updated to 4.3.2 and it doesnt happen anymore. Glad they fixed it.
对我来说,在Lion上安装Xcode 4.2.1发生了很多事情。更新到4.3.2,不再发生。很高兴他们固定。
#23
2
Mike Ash posted a solution (god bless him!) that doesn't require a reboot. Just run:
迈克·阿什发布了一个解决方案(上帝保佑他!),不需要重新启动。运行:
launchctl list|grep UIKitApplication|awk '{print $3}'|xargs launchctl remove
The above command lists out all launchd jobs, searches for one with UIKitApplication in the name (which will be the job corresponding to your app that's improperly sticking around), extracts the name, and tells launchd to get rid of that job.
上面的命令列出了所有launchd作业,在名称中搜索带有UIKitApplication的作业(它将是与你的应用程序相对应的不适当地粘在一起的作业),提取名称,并告诉launchd删除该作业。
#24
2
I think this is caused by force-quitting your app on the iPhone prior to pressing the stop button in Xcode. Sometimes when you press the stop button in Xcode, then it takes extra time to quit the app if it hung. But just be patient, it will eventually quit most of the time.
我认为这是由于在按下Xcode中的stop按钮之前,强行退出iPhone上的应用程序造成的。有时候,当你在Xcode中按下stop按钮时,如果应用程序挂起了,你需要额外的时间来退出它。但是耐心点,它最终会在大多数时候退出。
#25
1
You may alloc variable in function or tab. It will dealloc if your function or tab is quit. So you must declarate it member variable or global variable.
您可以在函数或选项卡中alloc变量。如果您的函数或选项卡退出,它将dealloc。所以你必须声明它是成员变量还是全局变量。
#26
1
I was getting this error all the time until I stopped trusting the "Stop" button in the Run dialog box. Now that I always hit stop in the toolbar before trying to run, I have yet to encounter any zombie processes.
我一直在得到这个错误,直到我停止信任运行对话框中的“停止”按钮。现在,在尝试运行之前,我总是在工具栏中单击stop,但我还没有遇到任何僵尸进程。
#27
0
Oh my - I tried EVERYTHING listed above and in other posts. Re-installed Xcode, rebooted my machine, copied all the missing files into the right folders... Eventually I backed-up my iphone, wiped it and restored it, and it worked!
哦,天哪,我尝试了上面列出的所有东西和其他的帖子。重新安装Xcode,重新启动我的机器,将所有丢失的文件复制到正确的文件夹中……最后,我把我的iphone备份了,擦了擦,恢复了它,它成功了!
I think what may have been the cause from reading in and around this was disconnecting my iphone white it was running with performance tools catching leaks. Or some such thing.
我想可能是阅读了这篇文章的原因是我的iphone白色手机断了线它是用性能工具捕捉漏洞的。或一些这样的事。
Aaaah, big sigh of relief.
啊,松了一口气。
#28
0
In most worst condition Reset content and setting of iOS Simulater, and most of the time in my case, quitting XCode along with simulator, always work works for me with XCode4.6 (that frequently get hanged)
在最坏的情况下,重置内容和设置iOS Simulater,在我的情况下,大多数时候,退出XCode和模拟器,总是在XCode4.6(经常挂掉)下为我工作
#29
0
I faced this kind of issue once in my case here's what i did
我曾经遇到过这样的问题这是我做的
- Delete the app from simulator.
- 从模拟器中删除app。
- Delete the derived data folder.
- 删除派生数据文件夹。
- Perform a clean action in the project by selecting the product menu - clean
- 通过选择产品菜单- clean,在项目中执行干净的操作。
- Reset the simulator.
- 重置模拟器。
- Quit Xcode.
- Xcode辞职。
- Try running the project now if its working fine else go to step 7
- 如果项目运行良好,请尝试运行到第7步
- Repeat all steps from 1 to 5 and then restart your machine.
- 重复从1到5的所有步骤,然后重新启动机器。
In most of the cases i got it running at step 6 extreme cases i had to restart my machine.
在大多数情况下,我在第6步的极端情况下运行,我不得不重新启动我的机器。
#30
0
This error used to occur in older versions of the iOS Simulator because older instances of a job in another device that was shutting down could collide with the new instance.
这个错误通常发生在iOS模拟器的旧版本中,因为在另一个正在关闭的设备中,作业的旧实例可能与新实例发生冲突。
iOS 6.0 and later should not experience issues like this because iOS 6.0 introduced the usage of bootstrap subsets, and iOS 7.0 introduced the usage of a dedicated bootstrap server (launchd_sim) which is completely isolated from the host's bootstrap server.
ios6.0和以后不应该遇到这样的问题,因为ios6.0引入了bootstrap子集的用法,而ios7.0引入了专用引导服务器(launchd_sim)的使用,它完全从主机的引导服务器中分离出来。
#1
160
Try quitting and restarting the simulator? If "worse comes to worst" you can always try restarting: in my experience this should fix it.
尝试退出并重新启动模拟器?如果“最糟糕的事情来了”,你可以试着重新开始:根据我的经验,这应该能解决它。
#2
242
status: this has been seen as recently as Mac OS 10.8 and Xcode 4.4.
状态:这是最近的Mac OS 10.8和Xcode 4.4。
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.,
否则,唯一已知的修复方法是重新启动用户launchd。重新引导可以做到这一点,但是有一种不太激烈/更快的方法。您将需要创建另一个admin用户,但您只需要创建一次。当事情偏离正轨时,以你自己的身份登入,以那个用户的身份登入,并终止属于你的主要用户的发射,例如,
sudo kill -9 `ps aux | egrep 'user_id .*[0-9] /sbin/launchd' | awk '{print $2}'`
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.
用用户名替换user_id。再次登录,作为您的正常用户让您回到正常状态。有点痛苦,但还不如完全重启。
details:
细节:
This has started happening more often with Lion/Xcode 4.2. (Personally, I never saw it before that combination.)
在Lion/Xcode 4.2中,这种情况开始发生得更频繁。(就我个人而言,我从未见过这种组合。)
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.
这个bug似乎出现在launchd中,当调试器停止调试时,它将把应用程序进程继承为子进程,而不会杀死它。这通常是应用程序变成僵尸的信号,在ps中有Z的进程状态。
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.
核心问题出现在bootstrap名称服务器中,该服务器在launchd中实现。这(在我理解的范围内)将应用程序id映射到mach端口。当这个bug被触发时,该应用程序就会死,但不会从引导服务器的名称服务器映射中清除,因此,引导服务器拒绝允许以相同的名称注册该应用程序的另一个实例。
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.
人们希望(看到评论)迫使launchd等待僵尸来解决问题,但事实并非如此。不是僵尸状态才是核心问题(这就是为什么有些僵尸是良性的),而是引导名称服务器,而且没有任何已知的方法可以清除这种短杀启动。
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.
看起来这个bug是由Xcode、gdb和用户launchd之间的错误触发的。我在iphone模拟器中运行了一个应用程序,让它在gdb中停止,然后进行构建并运行到ipad模拟器中。它似乎对切换模拟器很敏感(iOS 4.3/iOS 5、iPad/iPhone)。它不会一直发生,但当我频繁地切换模拟器时,它会发生得很频繁。
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.
在登录时杀死launchd会使您的会话陷入混乱。退出和返回登录不会杀死用户launchd;OS X保留了现有的进程。重启会修复问题,但这很痛苦。上面的说明更快。
I've submitted a bug to Apple, FWIW. rdar://10330930
我向苹果提交了一个错误,FWIW。rdar:/ / 10330930
#3
70
I find I have started having this issue with Lion + Xcode 4.2. I have also experienced the issue in Xcode 4.3.
我发现我已经开始在Lion + Xcode 4.2中遇到这个问题。我在Xcode 4.3中也遇到过这个问题。
I have tried all the suggestions but none of them have worked other than a full reboot.
我已经尝试了所有的建议,但除了完全重新启动之外,没有一个是有效的。
Here is how you determine if you require a reboot quickly.
以下是您如何确定是否需要快速重启。
List out all your Zombie processes:
列出你所有的僵尸程序:
ps -el | grep 'Z'
If you see your app listed as a Zombie process you will need to reboot your machine. The error message states "This generally means that another instance of this process was already running or is hung in the debugger". Well, Xcode is detecting this Zombie process which you can't kill. The only way you can then fix it is with a system reboot. :(
如果你看到你的应用程序被列为僵尸进程,你需要重新启动你的机器。错误消息声明“这通常意味着该进程的另一个实例已经在运行或挂起在调试器中”。Xcode发现了这个僵尸进程你无法杀死它。只有通过系统重新启动才能修复它。:(
EDIT, 20120823: I have some better knowledge of Zombie processes so I wanted to update this answer. A Zombie process is created when a parent process does not call wait() (wait for process to change state) on a terminating child process. You can't run 'kill' directly on a Zombie process but if you kill the parent process, the zombie child process will be 'reaped' and removed from the process table.
编辑,20120823:我对僵尸进程有了更好的了解,所以我想更新这个答案。当父进程在终止子进程中不调用wait()(等待进程更改状态)时,将创建一个僵尸进程。不能直接在僵尸进程上运行“kill”,但是如果您杀死了父进程,那么僵尸子进程将被“回收”并从进程表中删除。
I haven't seen this issue in a long while so haven't inspected to see what the parent process is in this scenario. The alternative to killing the parent process is to reboot your system. :)
我已经很久没有看到这个问题了,所以还没有检查父进程在这个场景中是什么。杀死父进程的替代方法是重新启动系统。:)
#4
20
I just had this happen to me: I was getting the error only on my device and the simulator was working fine. I ended up having to reset my device and the error went away.
我遇到了这样的情况:我只能在我的设备上得到错误,而且模拟器运行良好。我不得不重新设置我的设备,错误消失了。
#5
15
I'm having this problem very often recently. What would prevent this from occurring? Logging out and in fixes the problem but.. it's annoying to do so every so often.
最近我经常遇到这个问题。怎样才能防止这种情况发生呢?退出并进入修复问题,但是。经常这样做很烦人。
EDIT:
编辑:
I just found the cause. I had a bug in ApplicationWillTerminate method. So when i click stop button on Xcode window, app couldn't properly terminate and started to hang.
我刚找到原因。我在申请中有一个错误。所以当我点击Xcode窗口上的stop按钮时,app无法正常终止并开始挂起。
check Activity Monitor to see if your app is on the list. force quit if possible.
检查活动监视器,看看你的应用是否在列表中。“强制关闭”如果可能的话。
#6
14
If you find your problem is due to zombie processes:
如果你发现你的问题是由于僵尸程序:
ps -el | grep 'Z'(as in the earlier comment https://*.com/a/8104400/464289) and just want to fix the problem immediately, you can do so without rebooting or killing anything. Just rename your project target executable:
- Click on the project on the left-hand pane
- 单击左边窗格上的项目
- Select Build Settings in the middle pane
- 在中间窗格中选择Build设置
- Under 'Packaging' change 'Product Name' from $(TARGET_NAME) to $(TARGET_NAME).1
- 在“打包”下,将“产品名称”从$(TARGET_NAME)更改为$(TARGET_NAME).1
Easy!
简单!
#7
7
Well, no answers but at least one more test to make. Open Terminal and run this command: "ps-Ael | grep Z". If you get two entries, one "(clang)" and the other your app or company name, you're hosed - reboot.
好吧,没有答案,但至少再做一个测试。打开终端,运行以下命令:“ps-Ael | grep Z”。如果你得到两个条目,一个是“(铿锵)”,另一个是你的应用程序或公司名称,你就会被踢-重启。
If you are a developer, enter a short bug and tell Apple how absolutely annoying having to reboot is, and mention they can dup this bug to "rdar://10401934" which I just entered.
如果你是一名开发人员,输入一个简短的bug,告诉苹果必须重新启动是多么烦人,并告诉他们可以把这个bug复制到我刚刚输入的“rdar:/ 10401934”。
David
大卫
#8
5
Resetting the iOS Simulator fixed the error for me. Although this will remove all of the Apps you have in Simulator, it fixes the problem without having to restart the machine.
重置iOS模拟器为我修正了错误。尽管这将删除模拟器中的所有应用程序,但它无需重新启动机器就能修复问题。
You can reset your iOS Simulator by doing the following:
您可以通过以下操作重置您的iOS模拟器:
1) Go to the "iOS Simulator" menu, next to the Apple () logo on the far left of your main screen.
2) Select "Reset Content and Settings...".
3) Read the pop message and if you agree click "Reset" otherwise, click "Don't Reset".
1)“iOS模拟器”菜单,旁边的苹果()标志您的主屏幕左边。2)选择“重置内容和设置…”。3)阅读pop消息,如果你同意点击“重置”,否则点击“不重置”。
#9
4
I had the problem @jyap mentions with zombie processes. The only way to clear them was to reboot. However, I noticed that my friends working on the same project would get the same issue but could kill the simulator without creating a zombie process. I completely uninstalled Xcode and re-installed it, and while I still get the error, it doesn't create zombie processes, so I don't have to reboot.
我遇到了@jyap提到的僵尸进程的问题。清除它们的唯一方法是重启。然而,我注意到我的朋友们在同一个项目上也会遇到同样的问题,但是可以在不创建僵尸程序的情况下杀死模拟器。我完全卸载了Xcode并重新安装了它,虽然我仍然得到错误,但它没有创建僵尸进程,所以我不必重新启动。
Before I did that, I was using this really ugly workaround: change your app ID and run again. You end up with junk copies of the app in the simulator, but you can put off rebooting for a while.
在此之前,我使用了一个非常糟糕的解决方案:更改应用程序ID并再次运行。你最终会在模拟器中看到垃圾版本的应用,但你可以推迟重启一段时间。
#10
4
This error happens a lot to me, almost every time I test the app in the Simulator, forcing me to restart.
这个错误经常发生在我身上,几乎每次我在模拟器中测试应用程序时,都迫使我重新启动。
Here's a workaround if you want to get some work done:
如果你想完成一些工作,这里有一个变通的办法:
- Click your project in the Project navigator
- 在项目导航器中单击项目
- Go Target -> Info
- 目标- >信息
- Add a key for Application does not run in background and set to
YES
. - 为应用程序添加一个关键字,不能在后台运行,并设置为YES。
This will mean that when you press the home button in the simulator or quit the simulator, the app doesn't hang.
这意味着当你在模拟器中按home键或退出模拟器时,应用程序不会挂起。
Don't forget to change this setting back before distribution! Put it on your release checklist :)
不要忘记在分发之前更改此设置!把它写在你的发布清单上:)
#11
4
If this happens when testing on the iPhone. Just restart the phone. From what I have been told the phone or simulator still believes there is an instance of the app running, so when it was last run it had not terminated correctly do to either an error in your code or the phone/simulator just wanted to have a moan.
如果在iPhone上测试时发生这种情况。只是重新启动手机。据我所知,手机或模拟器仍然相信有一个应用程序实例在运行,所以当它最后一次运行时,它并没有正确地终止你的代码中的错误,或者手机/模拟器只是想发出呻吟。
#12
4
I got this error while debugging my app on an iPhone 4. Hard rebooting the iPhone solved my problem. (Powering off the iPhone hung...)
我在iPhone 4上调试我的应用程序时犯了这个错误。重新启动iPhone解决了我的问题。(切断iPhone的电源……)
I did not have any zombie process on my mac and rebooting the mac did not solve the problem.
我的mac上没有任何僵尸进程,重新启动mac也不能解决问题。
Maybe this bug can manifest itself on both the simulator and actual devices???
也许这个bug可以在模拟器和实际设备上显示出来?
#13
4
Restarted the Device, Worked! :D
重启设备,工作!:D
Thanks Everyone for the great suggestions.
谢谢大家的建议。
#14
3
I just had this error. I tried restarting the simulator and Xcode but my project would only work again after a clean and build. No idea what caused it.
我刚犯了这个错误。我尝试重新启动模拟器和Xcode,但我的项目只有在经过干净和构建之后才能再次运行。不知道是什么引起的。
#15
3
I had a recursive setter that blew through the stack and killed my app in such a way that I had to power boot my iPad. It was provable with a fix in the code.
我有一个递归setter,它在栈中爆掉了我的应用程序,我不得不启动我的iPad。可以用代码中的修正来验证它。
#16
3
- Close simulator
- 关闭模拟器
- Stop the app from running in xCode.
- 停止应用程序在xCode中运行。
- Open Activity Monitor and search for a process running with your App NAME.
- 打开活动监视器并搜索一个进程运行与您的应用程序名称。
- Kill this process in Activity Monitor
- 在活动监视器中关闭此进程
- Rebuild your project and you should be all set
- 重新构建您的项目,您应该已经准备好了
#17
3
I had same problem and solved it by doing the following
我有同样的问题,通过下面的方法解决了这个问题。
- Deleting the app from the device,
- 从设备中删除app,
- Disconnecting the device from Mac,
- 断开设备与Mac的连接,
- Turning the device off and back on,
- 把设备关了又开,
- Quitting and relaunching Xcode,
- 戒烟和重振Xcode,
- Quitting Instruments,
- 戒烟工具,
- Finally, Clean and Build again.
- 最后,再次清洁和重建。
I also did one more thing, because Xcode is configured to use iOS 5.0 and my project uses iOS 4.3
我还做了一件事,因为Xcode被配置为使用iOS 5.0,我的项目使用iOS 4.3
- Remove all frameworks and add them again.
- 删除所有框架并再次添加它们。
#18
3
Alternate workaround:
备选解决方案:
- Give your app a new identifier. If it's called com.foobar.myapp, call it com.foobar.myapp01
- 给你的应用一个新的标识符。如果这叫做com.foobar。myapp,称之为com.foobar.myapp01
You lose all data in the app as it's actually a new app running as far as the iPhone simulator is concerned. This may or may not be more annoying than rebooting - just wanted to add it to the list.
你会丢失应用中的所有数据,因为它实际上是一个运行在iPhone模拟器上的新应用。这可能比重新启动更烦人,也可能不是更烦人——只是想把它添加到列表中。
#19
3
The Cause
的原因
Running your app in the Simulator before the previously running app has completely stopped.
在先前运行的应用程序完全停止之前,在模拟器中运行你的应用程序。
The Fix
修复
Wait until you see the Stop button become active again before running again.
在再次运行之前,请等待看到停止按钮再次激活。
(I'm using Xcode 4.2.1. This problem happened very frequently when I upgraded to OS X Lion).
(我使用Xcode 4.2.1。准备当我升级到OS X Lion时,这个问题经常发生。
#20
2
Fixed by rebooting my phone after deleting the app, then rebuilding it clean and running again. Works fine now.
修正了在删除应用程序后重新启动手机,然后重新构建它并重新运行。工作好了。
Weird.
奇怪。
#21
2
No rebuild or reinstall needed for my issue, and in my case the error appeared when trying to run the app on the iPhone. Simulator worked fine.
我的问题不需要重新构建或重新安装,在我的例子中,当我试图在iPhone上运行应用程序时出现了错误。模拟器运行良好。
Solution: Delete app off phone, do a cold restart of phone and now all is well.
解决方案:删除手机应用,冷重启手机,现在一切都好了。
#22
2
Happened a lot for me with Xcode 4.2.1 on Lion. Updated to 4.3.2 and it doesnt happen anymore. Glad they fixed it.
对我来说,在Lion上安装Xcode 4.2.1发生了很多事情。更新到4.3.2,不再发生。很高兴他们固定。
#23
2
Mike Ash posted a solution (god bless him!) that doesn't require a reboot. Just run:
迈克·阿什发布了一个解决方案(上帝保佑他!),不需要重新启动。运行:
launchctl list|grep UIKitApplication|awk '{print $3}'|xargs launchctl remove
The above command lists out all launchd jobs, searches for one with UIKitApplication in the name (which will be the job corresponding to your app that's improperly sticking around), extracts the name, and tells launchd to get rid of that job.
上面的命令列出了所有launchd作业,在名称中搜索带有UIKitApplication的作业(它将是与你的应用程序相对应的不适当地粘在一起的作业),提取名称,并告诉launchd删除该作业。
#24
2
I think this is caused by force-quitting your app on the iPhone prior to pressing the stop button in Xcode. Sometimes when you press the stop button in Xcode, then it takes extra time to quit the app if it hung. But just be patient, it will eventually quit most of the time.
我认为这是由于在按下Xcode中的stop按钮之前,强行退出iPhone上的应用程序造成的。有时候,当你在Xcode中按下stop按钮时,如果应用程序挂起了,你需要额外的时间来退出它。但是耐心点,它最终会在大多数时候退出。
#25
1
You may alloc variable in function or tab. It will dealloc if your function or tab is quit. So you must declarate it member variable or global variable.
您可以在函数或选项卡中alloc变量。如果您的函数或选项卡退出,它将dealloc。所以你必须声明它是成员变量还是全局变量。
#26
1
I was getting this error all the time until I stopped trusting the "Stop" button in the Run dialog box. Now that I always hit stop in the toolbar before trying to run, I have yet to encounter any zombie processes.
我一直在得到这个错误,直到我停止信任运行对话框中的“停止”按钮。现在,在尝试运行之前,我总是在工具栏中单击stop,但我还没有遇到任何僵尸进程。
#27
0
Oh my - I tried EVERYTHING listed above and in other posts. Re-installed Xcode, rebooted my machine, copied all the missing files into the right folders... Eventually I backed-up my iphone, wiped it and restored it, and it worked!
哦,天哪,我尝试了上面列出的所有东西和其他的帖子。重新安装Xcode,重新启动我的机器,将所有丢失的文件复制到正确的文件夹中……最后,我把我的iphone备份了,擦了擦,恢复了它,它成功了!
I think what may have been the cause from reading in and around this was disconnecting my iphone white it was running with performance tools catching leaks. Or some such thing.
我想可能是阅读了这篇文章的原因是我的iphone白色手机断了线它是用性能工具捕捉漏洞的。或一些这样的事。
Aaaah, big sigh of relief.
啊,松了一口气。
#28
0
In most worst condition Reset content and setting of iOS Simulater, and most of the time in my case, quitting XCode along with simulator, always work works for me with XCode4.6 (that frequently get hanged)
在最坏的情况下,重置内容和设置iOS Simulater,在我的情况下,大多数时候,退出XCode和模拟器,总是在XCode4.6(经常挂掉)下为我工作
#29
0
I faced this kind of issue once in my case here's what i did
我曾经遇到过这样的问题这是我做的
- Delete the app from simulator.
- 从模拟器中删除app。
- Delete the derived data folder.
- 删除派生数据文件夹。
- Perform a clean action in the project by selecting the product menu - clean
- 通过选择产品菜单- clean,在项目中执行干净的操作。
- Reset the simulator.
- 重置模拟器。
- Quit Xcode.
- Xcode辞职。
- Try running the project now if its working fine else go to step 7
- 如果项目运行良好,请尝试运行到第7步
- Repeat all steps from 1 to 5 and then restart your machine.
- 重复从1到5的所有步骤,然后重新启动机器。
In most of the cases i got it running at step 6 extreme cases i had to restart my machine.
在大多数情况下,我在第6步的极端情况下运行,我不得不重新启动我的机器。
#30
0
This error used to occur in older versions of the iOS Simulator because older instances of a job in another device that was shutting down could collide with the new instance.
这个错误通常发生在iOS模拟器的旧版本中,因为在另一个正在关闭的设备中,作业的旧实例可能与新实例发生冲突。
iOS 6.0 and later should not experience issues like this because iOS 6.0 introduced the usage of bootstrap subsets, and iOS 7.0 introduced the usage of a dedicated bootstrap server (launchd_sim) which is completely isolated from the host's bootstrap server.
ios6.0和以后不应该遇到这样的问题,因为ios6.0引入了bootstrap子集的用法,而ios7.0引入了专用引导服务器(launchd_sim)的使用,它完全从主机的引导服务器中分离出来。