How can I programmatically trigger the shake event in iOS?
I've tried the following but it keeps crashing...
+ (void)shake {
NSLog(@"TEST");
UIMotionEventProxy *m = [[NSClassFromString(@"UIMotionEvent") alloc] _init];
m->_subtype = UIEventSubtypeMotionShake;
m->_shakeState = 1;
[[[UIApplication sharedApplication] keyWindow] motionBegan:UIEventSubtypeMotionShake withEvent:m];
[[[UIApplication sharedApplication] keyWindow] motionEnded:UIEventSubtypeMotionShake withEvent:m];
}
What does apple do in the simulator under Hardware > Shake Gesture
?