views:

210

answers:

0

So ... we have this bit of motion detection:

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (event.type == UIEventTypeMotion && event.subtype == UIEventSubtypeMotionShake) {
        [[NSNotificationCenter defaultCenter] postNotificationName:@"ShakeBegan" object:self];
    }
}

Innocuous enough. We also check motionEnded:withEvent: and motionCanceled:withEvent:, but for now let's look at this one.

When I debug the app with breakpoints disabled, and shake the device one time, motionBegan:withEvent: is called once.

However, when I debug the app with breakpoints enabled and shake the device one time, even if I don't drop an actual breakpoint anywhere (a console log will do just fine), motionBegan:withEvent: is called twice!

Is that a bug ... or a feature ... or something in between ... or am I doing something else wrong? Thoughts?