Search code examples
iosipadios-simulatormotionshake

iPad doesn't detect shake-motion events


The simulator detects shake-motion event without a problem. When I run the app on the physical device (iPad 2) - nothing is happening. I am starting to doubt myself if I know how to shake it...

I think I have done everything which is necessarily:

-(BOOL)canBecomeFirstResponder{
    return YES;
}

calling becomeFirstResponder on the view;

and I have implemented:

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event;
- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event;

Do you have any suggestions? Why is it working on the Simulator and nothing is happening on the device?

This questions resembles very well my situation: Shake Motion events not working but it doesn't help me a lot.


Solution

  • I have found and 'fixed' my problem.

    The device should be set to iPad or Universal in order an iPad to detect the shake motion. It may be obvious (but apparently I have missed it) ... I wanted to produce just a sample application and I have forgotten to change the default setting from 'iPhone' to 'iPad'.

    enter image description here