iOS振动检测不出来

从代码中的反馈就是motionEnded等方法没有被调用,检查以下几点

1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions中是否设置了application.applicationSupportsShakeToEdit = YES;

2. 对应的ViewController中是否实现了

- (BOOL)canBecomeFirstResponder

{

    return YES;

}

- (void)viewDidAppear:(BOOL)animated

{

    [super viewDidAppear:animated];   

    [self becomeFirstResponder];

 }


你可能感兴趣的:(iOS)