I have come across this error two or three times before, and each time I spend hours trying to figure out how to get my virtual machine to boot. This blog post is just to document a fix so that I can refer back to it, and hopefully it will help people out if they’re experiencing the issue as well.
For iOS developers, this is a really cool technique. Sometimes you want to see all the NSNotifications that get posted in your app, whether it is for debugging, or to see the timing of where listeners can be hooked in. Using breakpoints in Xcode will allow us to inspect the notifications.
Follow this procedure to set it up:
In Xcode, open the breakpoints panel on the left sidebar.
Click the + icon at the bottom left of the panel. Select “Add Symbolic Breakpoint…“
Enter the following details: Symbol:-[NSNotificationCenterpostNotificationName:object:userInfo:]
Click Add Action and enter the following details: Debugger Command:po $r2 This prints out the 3rd parameter (internally speaking) — the name of the notification. The first two parameters if you’re curious are the NSNotificationCenter instance, and the command/message. Updated June 7, 2015: If you are getting error: use of undeclared identifier '$r2' try using po $arg3 instead.
Select “Automatically continue after evaluating“.
Your breakpoint settings should look like this:
You will then need to run the application on a device (sorry, this doesn’t work on the simulator). Note that if your application produces many notifications constantly, the speed of the application will be significantly slower, due to the breakpoints being processed. To work around this, you can disable the breakpoint until you get to the place where you want to analyze the notifications.