Couldn't register with the bootstrap Server

2019-01-08 05:56发布

I just changed some code in my program and got this error:

Couldn't register com.yourcompany.XXX 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 restoring my program to a version that worked, rebooted, restarted, empty caches and rebuild on versions that even worked before.

Any help would be appreciated.

21条回答
霸刀☆藐视天下
2楼-- · 2019-01-08 05:57

I opened a bug report with Apple: https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/19/wo/WBbbbyopNFW8FFUuNSbk0w/10.66

Please let me know if you can't access it.

Summary: XCode debugger is not releasing bootstrap server port

Steps to Reproduce: While debugging an iPhone iOS5 app in the simulator in Xcode 4.2 Build 4D5163b on Lion 10.7.2, a crash can sometimes result in being unable to start the bugger. Instead, Xcode produces this error:

Couldn't register com.MyApp.MyApp 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”.

Expected Results: Should be able to start debugger after a crash.

Actual Results: Cannot start debugger. The only way I've discovered to make the simulator work again is to restart Mac OS.

Regression:

Notes: Lots of people are having this problem: iPhone - strange error when testing on simulator Couldn't register with the bootstrap Server Bootstrap Server Error in Xcode IPHONE https://discussions.apple.com/message/10416765?messageID=10416765

Quitting XCode and the Simulator (& ensuring ps -Al | egrep "Xcode|Simulator" returns nothing) does not help the problem.

Running "launchtl bslist | grep MyApp" reveals that com.MyApp is still registered with the bootstrap server:

$ launchctl bslist | grep MyApp
A  com.MyApp.MyApp.UIKit.migserver
A  com.MyApp.MyApp

I wrote some code to find the port and invalidate it, but this too fails:

NSMachBootstrapServer *bsserver = [NSMachBootstrapServer sharedInstance];
NSMachPort *port = (NSMachPort *)[bsserver portForName:@"com.MyApp.MyApp"];
[port removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:<#(NSString *)#>
NSLog(@"port = %@",port);   
NSLog(@"port.isValid=%d",[port isValid]);
[port invalidate];
NSLog(@"port.isValid=%d",[port isValid]);       
查看更多
何必那么认真
3楼-- · 2019-01-08 05:59

Okay, I've got a workaround for the hardware issue that doesn't involve rebooting the phone. I assume this will also work on the simulator but I haven't tried it.

Force Springboard to relaunch by changing the language. Settings -> General -> International -> Language.

I just changed it to Spanish, waited for Springboard to relaunch, changed it back to English, and was good to go.

查看更多
啃猪蹄的小仙女
4楼-- · 2019-01-08 06:02

I was able to recover from this by unplugging the iPad, powering it down and back up, clearing all XCode caches and targets, and doing a clean build. I'm running XCode 3.5.4 and iOS 4.2.1 Hope this helps someone. -Mike

UPDATE: Same problem running Xcode 4.3 and iOS5 - just power-cycle the device.

查看更多
太酷不给撩
5楼-- · 2019-01-08 06:02

You might wish to kill all Simulator processes, that can cause this error as well.

Here's a one-liner to kill 'em all:

kill -9 `ps ax | grep Simulator | grep -v grep | awk '{print $1}'` 

Or more concise, like @brianegge mentions as a comment:

killall -9 Simulator
查看更多
Root(大扎)
6楼-- · 2019-01-08 06:02

Lot's of good answers have been provided for fixing the problem.

I have found that I can recreate this bug by creating a breakpoint in my code so that the execution pauses. Then if I press on the Stop Button the bug will now appear when I try to run the code again. Resuming the execution before pressing the Stop Button therefore avoids this issue.

Hope this helps.

查看更多
唯我独甜
7楼-- · 2019-01-08 06:04

This may be caused by an instance of your app running in the background. This simplified process worked for me without even having to close xCode or shutdown my computer.

  1. Close simulator
  2. Stop the app from running in xCode.
  3. Open activity monitor and search for a process running with your App NAME.
  4. Kill this process in Activity Monitor
  5. Rebuild your project and you should be all set

In theory Pål's command line solution should work as well. The issue definitely seems to be caused by an extra instance of the app running in the background. The app does not always seem to be getting killed properly after each test in simulator or on the device. I first noticed this when jumping between simulator and a device frequently.

As a preventive measure it is good practice to always hit the stop button in xCode after each test.

查看更多
登录 后发表回答