[ 
https://issues.apache.org/jira/browse/CB-9179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14607502#comment-14607502
 ] 

George Atkins commented on CB-9179:
-----------------------------------

I have hit this issue also - it has been around for at least a year.

In CDVCompass.m, the code to get the trueHeading is:
{code:borderStyle=solid}
id trueHeading = __locationStarted ? (id)[NSNumber numberWithDouble : 
hInfo.trueHeading] : (id)[NSNull null];
{code}

The issue is that the private variable __locationStarted is initialised to 
"NO", and never set elsewhere, which in turn means the above code always 
returns null.

It appears this variable is actually defunct, along with __highAccuracyEnabled. 
It looks like CDVCompass and CDVLocation were once combined and these variables 
are left over from that, as neither of these variables are set anywhere. 

If I simply set __locationStarted = YES, then I get the correct trueHeading 
values. Note I am using navigator.geolocation.watchPosition at the same time 
too. If location services are turned off on the device then -1 is returned.

BTW - it looks like navigator.geolocation.watchLocation() is defunct as I can't 
find any recent reference to it anywhere. 

> [ios] the trueHeading property is still null after use 
> navigator.geolocation.watchLocation()
> --------------------------------------------------------------------------------------------
>
>                 Key: CB-9179
>                 URL: https://issues.apache.org/jira/browse/CB-9179
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS, Plugin Device Orientation
>    Affects Versions: 5.0.0
>         Environment: iOS 8.3
> cordova-plugin-device-orientation 1.0.0
>            Reporter: Colin Bau
>   Original Estimate: 12h
>  Remaining Estimate: 12h
>
> according this
> https://github.com/apache/cordova-plugin-device-orientation
> it said...
> The trueHeading property is only returned for location services enabled via 
> navigator.geolocation.watchLocation().
> but in fact...the trueHeading property is still null after use 
> navigator.geolocation.watchLocation()



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to