Skip to content

Commit

Permalink
Merge pull request #935 from Corvus400/bug/fix_ios_orientation_sensor…
Browse files Browse the repository at this point in the history
…_manager

🔧 Fixed a problem where the motion sensor would not work on iOS.
  • Loading branch information
takahirom authored Sep 3, 2024
2 parents 78b5b8a + 071b4d5 commit 27e8386
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ internal class IosOrientationSensorManager(
private val motionManager = CMMotionManager()

override fun start() {
if (!motionManager.deviceMotionActive) {
if (!motionManager.deviceMotionAvailable) {
return
}
NSOperationQueue.currentQueue()?.let {
NSOperationQueue.mainQueue().let { queue ->
motionManager.startDeviceMotionUpdatesToQueue(
it,
queue,
) { motion, _ ->
if (motion == null) {
return@startDeviceMotionUpdatesToQueue
Expand Down

0 comments on commit 27e8386

Please sign in to comment.