devfd/react-native-geocoder

undefined is not an object (evaluating 'RNGeocoder.geocodePosition')

joaoalbertocsjunior opened this issue · 4 comments

Im getting this message, when trying to do reverse geocoding on rn using this package.

The code is as follows:

import Geocoder from 'react-native-geocoder';
locationPos = {
      lat: positionToInsert.latitude,
      lng: positionToInsert.longitude
    }
Geocoder.geocodePosition(locationPos).then(res => {
      this.setState({locPos: res[0].formattedAddress})
    })
    .catch(err => console.log(err))

@joaoalbertocsjunior Did you forget to add libRNGeocoder.a file to build phases?

I did add the library and I'm still getting this error.

just use react-native link react-native-geocoder and pod update

@joaoalbertocsjunior try to put libRNGeocoder.a in Target > Build phase > Link Libraries