Sorry this is so troublesome. I unfortunately can't test on the iPhone here and I'm not getting the same error's you're getting. My thoughts are that this is an "order of destruction" problem, that when you close the receiver in the
io_service wants to hand back an error that the
read, function, which may have already completed, has been canceled. With the
willEnterForeground function, you destroy the instance before the
io_service is polled, thereby taking the rug out from under the
You could check out if that's happening by break pointing at the
reset of the
willEnterForeground and at the
errorHandler in the
ReceiverUdp where it's been crashing, and see which is called first. If the
reset is called first then there's the problem.
If that's in fact what's happening, I'd close the receiver in
didEnterBackground, and then poll the
io_service, so that it can propogate the error, and then
ReceiverUdp. Hopefully that will remove the crash. Let me know if that helps or if the problem still persists.