NSTimer设置定时振动时,重新唤醒出现连续振动的问题

__block MSDynamicViewController *blockSelf = self;

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

       blockSelf->_vibrateTimer =[NSTimer scheduledTimerWithTimeInterval:1.0

                                                                                                    target:blockSelf

                                                                                                 selector:@selector(vibrateAction)

                                                                                                userInfo:nil

                                                                                                 repeats:YES] ;

       [[NSRunLoop currentRunLoop] addTimer:blockSelf->_vibrateTimer forMode:NSDefaultRunLoopMode];

       [[NSRunLoop currentRunLoop] run];

});

设置当手机用timer实现振动时,home键退出后,再进去软件手机不会持续振动。

posted @ 2016-08-15 11:55  老茶叶  阅读(153)  评论(0)    收藏  举报