Post

Replies

Boosts

Views

Activity

CMHeadphoneMotionManager handler not called
Hi, Looking to experiment with the new CMHeadphoneMotionManager AirPods Motion API on iOS 14, but I'm facing issues with the CMHeadphoneMotionManager.startDeviceMotionUpdates handler not being called. After installing the beta on an iPad Pro 11" (2020, iOS 14.0 18A5301v), I connect a pair of AirPod Pros (firmware 2D15, hardware 1.0.0), and run the following MVP reproducible case I'm using to test — import UIKit import CoreMotion class ViewController: UIViewController, CMHeadphoneMotionManagerDelegate  {     var motionManager: CMHeadphoneMotionManager!     override func viewDidLoad() {         super.viewDidLoad()         motionManager = CMHeadphoneMotionManager()         motionManager.delegate = self         if motionManager.isDeviceMotionAvailable {             motionManager.startDeviceMotionUpdates(to: OperationQueue.main) { (motion, error) in                 print(error)                 print(motion)             }         }     }     func headphoneMotionManagerDidConnect(_ manager: CMHeadphoneMotionManager) {         print("connect")     }     func headphoneMotionManagerDidDisconnect(_ manager: CMHeadphoneMotionManager) {         print("disconnect")     } } isDeviceMotionAvailable returns true, but the handler (and delegate methods) are never called. Is there a sample project for CMHeadphoneMotionManager? Am I missing something obvious? Thanks!
15
0
4.2k
Jun ’20