Next article: Friday Q&A 2012-05-18: A Tour of PLWeakCompatibility: Part I
Previous article: Friday Q&A 2012-05-04: PLCrashReporter and Unwinding the Stack With DWARF, Part 2
Tags: apple hack xcode
I'm sure every iOS developer has seen the dreaded bootstrap error. "Couldn't register com.yourcompany.yourapp 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." After nearly throwing my Mac out the window for the Nth time today, I finally managed to come up with a simple fix. Run this in the shell: launchctl list|grep UIKitApplication|awk '{print $3}'|xargs launchctl remove
. And your bootstrap errors magically melt away.
This occasionally happens when using Xcode to run iOS apps in the simulator. Although the error really gives no indication of it, it's apparently a hung launchd
job that somehow doesn't get cleaned up. 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.
I'm still not sure exactly why this error happens. And, as far as I know, the above can't be used on the actual device, so you still have to reboot those to solve it when it happens there, although that's much less painful than rebooting your development Mac. But the above works just fine as a workaround until Apple can get their act together on this problem. I saved the command into a shell script called unfuckbootstrap
that I can use whenever Xcode decides to screw up.
Comments:
I had this problem... maybe... a dozen times. Since nothing comes up when you hit 'ps'... i always ended up restarting whe mac. (Or switching from device to simulator... when it gets screwed up, you can still use one or another).
THANKS!!!
I am not sure what kind of sick irony caused this, but this script seems to have actually caused the problem to appear. Altho I have not had the bootstrap error for a few weeks, it used to plague me incessantly. Rebooting three or four times a day really stinks. So, I created a unfubarbootstrap.sh with your commands in it and test ran it, figuring this should be a no-op. Now, Xcode is throwing the bootstrap error.
I am not blaming you Mike, and thanks for tracking down the problem so specifically. Hopefully I won't ever need the script again :)
I am glad someone finally came up with a solution..that i cannot try : your solution seems to be the one because of the keyword "UIKitApplication", but what if all these commands should be ran on the device itself ?
I am facing this right now : device is unplugged from Xcode, and when i launch the app, it crashes with that log:
unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.************[0x4fd9]) Conflict with job: UIKitApplication:com.************[0x74e7] over Mach service: com.************
unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.************[0x4fd9]) Conflict with job: UIKitApplication:com.************[0x74e7] over Mach service: com.************.UIKit.migserver
unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.************[0x74e7]) The following job tried to hijack the service "com.************" from this job: UIKitApplication:com.************[0x4fd9]
unknown UIKitApplication:com.************[0x4fd9][467] <Notice>: Couldn't register com.************ with the bootstrap server. Error: unknown error code.
unknown UIKitApplication:com.************[0x4fd9][467] <Notice>: This generally means that another instance of this process was already running or is hung in the debugger.
Any idea ?
Thank you so much for this. I've been bitten by this error many times, but I've always been so busy with the actual project, that I really didn't have the time to investigate and find a solution.
Thank you for doing it for all of us.
Also, on a side note, love the shell script name.
Here is the output of launchctl list | grep UIKitApplication
36335 - UIKitApplication:com.company.iphoneTest[0xef85]
36276 - UIKitApplication:com.company.iphoneTest[0x8256]
When I try to run the script, I see the following:
usage: launchctl remove <job label>
I have even tried just executing it on portions of that label, ie without the bracket + address..
I'm stumped :-/ any ideas?
launchctl remove error: No such process
And I guess I just have to restart.
http://stackoverflow.com/questions/788277/iphone-strange-error-when-testing-on-simulator/7860828#7860828
I've tried a lot of approaches. I'll have to give this one a shot. I may have missed this as a separate launchd job (though it sounds like people have had mixed results ...)
This article led me to the problem: launchd was still restarting springboard and other iOS jobs from the older simulator when I wanted to start the newer version.
Removing all simulator jobs did the trick. Here's my updated unfuck script:
jobs=`launchctl list | grep -E "iPhoneSimulator|UIKitApplication" | awk '{print $3}'`
for job in $jobs
do
echo "launchctl remove $job"
launchctl remove "$job"
done
Comments RSS feed for this page
Add your thoughts, post a comment:
Spam and off-topic posts will be deleted without notice. Culprits may be publicly humiliated at my sole discretion.