我在iOS 7中发现了一个问题,这个问题经常发生,但并不总是。
首先,我像这样设置设备运动:
[self.motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXArbitraryCorrectedZVertical
toQueue:[NSOperationQueue currentQueue]
withHandler:motionHandler];在用户使用iOS 7锁定iPad迷你屏幕之前,它一直有效。当用户等待约5秒后再次解锁屏幕时,设备运动再次正常工作。
当用户在锁定屏幕后快速解锁时,设备运动停止工作,处理程序也不再被调用。
我假设在这种情况下,程序员必须手动重新启动设备运动。保证设备运动成功运行的推荐方法是什么?
发布于 2014-01-23 05:20:12
尝试从AppDelegate重写这些方法
-(void)applicationWillResignActive:(UIApplication *)应用程序
-(void)applicationWillEnterForeground:(UIApplication *)应用程序
-(void)applicationDidBecomeActive:(UIApplication *)应用程序
GL HF
https://stackoverflow.com/questions/21291737
复制相似问题