You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Martin Robin (JIRA)" <ji...@apache.org> on 2014/01/09 14:46:52 UTC

[jira] [Created] (CB-5753) iOS: CDVLocation locationManager didFailWithError

Martin Robin created CB-5753:
--------------------------------

             Summary: iOS: CDVLocation locationManager didFailWithError
                 Key: CB-5753
                 URL: https://issues.apache.org/jira/browse/CB-5753
             Project: Apache Cordova
          Issue Type: Bug
          Components: iOS
    Affects Versions: 2.9.0, 2.9.1
         Environment: iOS
            Reporter: Martin Robin


The delegate handler for didFailWithError appears to have a couple of issues...

According to the [documentation|https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html#//apple_ref/occ/intfm/CLLocationManagerDelegate/locationManager:didFailWithError:], {quote}If the location service is unable to retrieve a location right away, it reports a kCLErrorLocationUnknown error and keeps trying. In such a situation, you can simply ignore the error and wait for a new event.{quote}
The handler within CDVLocation does not however take this into account and as a result if this error is raised it causes the location manager to be shut down without any warning.

Within the same handler, there appears to be code to send a notification back to the JavaScript by way of the onError function. This notification is never received in the JavaScript so the error cannot be handled (by calling clearWatch and then restarting with a call to watchPosition for example).

The first problem is (I believe) fairly easily resolved; simply ignoring the error (though possibly notifying the JavaScript) would suffice.

I have no idea how to resolve the second problem. I have tried tracing the code and it appears to call commandDelegate::sendPluginResult (via returnLocationError) but the onError function in the (my) JavaScript does not receive the error.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)