Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Fix heading update loop #9845

Merged

Conversation

friedbunny
Copy link
Contributor

@friedbunny friedbunny commented Aug 23, 2017

Fixes #9822, significantly reducing CPU usage during user heading tracking mode.

In #7716, we started calling layoutSubviews more often. If the compass were visible, this would then call updateHeadingForDeviceOrientation, which would set CLLocationManager.headingOrientation.

Even if there is no actual change in its value, setting CLLocationManager.headingOrientation triggers a new heading update, which in turn caused us to update the user location annotation and layoutSubviews again. This effectively disabled the heading filter and the loop would continue until heading tracking mode was disabled.

/cc @frederoni @fabian-guerra @1ec5

@friedbunny friedbunny added the iOS Mapbox Maps SDK for iOS label Aug 23, 2017
@friedbunny friedbunny added this to the ios-v3.6.3 milestone Aug 23, 2017
@friedbunny friedbunny self-assigned this Aug 23, 2017
Copy link
Contributor

@fabian-guerra fabian-guerra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍🏼

Updating CLLocationManager.headingOrientation triggers a new heading update, even if there was no actual change in its value.
@friedbunny
Copy link
Contributor Author

Filed rdar://34059173 and updated the comment in code.

@friedbunny friedbunny merged commit b2fd7b6 into release-ios-v3.6.0-android-v5.1.0 Aug 24, 2017
@friedbunny friedbunny deleted the fb-fewer-heading-updates-thx branch August 24, 2017 16:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants