I experienced the same issue, and after some experimentation learned enough to be able to work around it.
First, note that you can trigger this crash/hang at will simply by following these steps:
- Launch your app from Xcode (on either a device or a simulator).
- Optionally trigger a notification, and then press the Home button to minimise your app, and then double-tap the home button and fully close your app from the dock that appears.
- Without unplugging the device, closing the simulator, or closing Xcode, relaunch your app directly from the device or simulator, either by tapping a notification that summons the app or simply by tapping the app's icon on the home screen.
Now, if you're on a simulator, the app will immediately crash, and if you're on a real device, the entire device will hang and become unresponsive even to pressing the Home button until you unplug it or press the Run button again in Xcode.
The issue seems to manifest itself both in Xcode 4.6.3 and Xcode 5.0; I haven't tried other versions.
Needless to say, this bug really sucks if you're trying to test user interaction paths that involve fully relaunching the app from a notification, like the question asker here is (rather than simply testing the case where notifications bring your app into the foreground from the background). Fortunately, the bug is reasonably easy to work around.
If you're on a device, the workaround is simply: unplug the device from your Mac. The bug described above only manifests itself if the device is plugged into Xcode when you try to launch the app.
If you only have access to the simulator, it's a little trickier, but only slightly. First, use the instructions here to enable you to launch the simulator from outside Xcode:
- In Finder, browse to
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/
- Drag the
iOS Simulator
app from that folder to your dock.
- You can now launch the simulator as a standalone app from your dock any time you want to.
Now to test apps that use local notifications to completely relaunch the app:
- Launch your app on the simulator from Xcode.
- Trigger your local notification.
- Exit your app with the Home button.
- Double tap the home button and close your app from the simulator dock.
- Close the simulator with command + q
- Relaunch the simulator from the dock of your Mac.
- Wait for your notification.
- Tap the notification to relaunch the app.
- Observe that it doesn't instantly crash! Yay!
It's pretty silly that this is necessary, but at least applying this workaround doesn't take long.