Frage

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.

War es hilfreich?

Lösung

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

Andere Tipps

In case you don't want to shake your device all the time to test your app, here's an easy way to enable a one tap shake gesture on your physical iOS device: https://www.youtube.com/watch?v=WbUjMlxkfQ8

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top