문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top