I am developing code that will convert a given location(latitude, longitude) to the closest street address, i.e., a reverse geocode. I've found code on this issue that claims to work, and with some modifications on Android, it does. But on iOS, I'm unable to get beyond the call to reverseGeocodeLocationCompletionHandler. In particular, the call fails with the error message, "[TNSDictionaryAdapter coordinate]: unrecognized selector sent to instance"

I have created this Playground project the demonstrates the error. There are two things to note:

  1. The referenced code is typescript; my project is javascript, so I've made the appropriate changes
  2. The reference code's location argument is args.location.ios, but the location object has no .ios property, so I don't see how this could ever have worked. (There is this issue noting the same, but it was never resolved.)

So, my question, is how can I successfully call reverseGeocodeLocationCompletionHandler from a Nativescript javascript project. My afternoon's worth of google searching has yielded no results :-(


I guess the APIs have changed after the comments you are referring. The iOS attribute meant to return CLLocation. The latest version of plugin doesn't expose that method, keeps it for internal usage only.

A workaround is to call distance(location1, location2) method, so it will create the native location.

  const geolocation = require("nativescript-geolocation");


  var location = new geolocation.Location();
  location.latitude = 40.7127837;
  location.longitude = -74.00594130000002;


  let geocoder = new CLGeocoder();
  geolocation.distance(location, location);
    (placemarks, error) => {
      if (error) {
      } else if (placemarks) {
  • That did the trick! Thanks so much. I was guessing that the issue was that location was not a CLLocation, but I couldn't tell from scanning the geolocation plug-in source code. Once again you save the day! – David Jan 16 at 1:32

Your Answer

