Mon CLLocationManager fonctionne correctement. Je peux être remarqué lorsque la valeur de cap a changé.Comment arrêter CLLocationManager Modifier la valeur de l'entête lorsque l'iPhone roule un peu.
Cependant, j'ai trouvé que la valeur d'en-tête est différente lorsque l'iPhone lance même un petit peu d'angle de bit.
J'ai mis les
locationManager.headingOrientation = CLDeviceOrientation.landscapeRight
J'ai également définir d'autres propriétés:
locationManager.requestWhenInUseAuthorization()
orientation = getCLDeviceOrientation(by: UIDevice.current.orientation)
locationManager.desiredAccuracy = kCLLocationAccuracyBest
locationManager.headingFilter = 0.1
locationManager.headingOrientation = CLDeviceOrientation.landscapeRight
locationManager.startUpdatingHeading()
locationManager.delegate = self