2

When I try to reverse a coordinate which is somewhere in the South Atlantic Ocean,

let geocoder = GMSGeocoder.init()
let coordinate = CLLocationCoordinate2D.init(
    latitude: -33.724339999999998, 
    longitude: -15.996094000000001)

geocoder.reverseGeocodeCoordinate(coordinate) { (response, error) in 
  print(response)
})

fatal error: unexpectedly found nil while unwrapping an Optional value

Yes, I don't expect a response but it shouldn't fail with a fatal error, am I right?

Is that a normal behaviour for GMSGeocoder?

Okan Kocyigit
  • 12,633
  • 18
  • 64
  • 119

2 Answers2

0

So I've experienced this weird crash as well while using reverse geocode of Google Map and since you haven't neither chosen a correct answer nor posted your own solution. I checked the production build of my app (From App Store) is working fine. I did try stashing my changes just to check what crap I did that causes this crash.

The log also states something like this:

Google Maps SDK for iOS requires GoogleMaps.bundle to be part of your target

Now for the solution, I have posted it too here: https://stackoverflow.com/a/45607775/3231194

Basically just try to update your pods and clean the project and the build, then you're good to go.

Glenn Posadas
  • 10,706
  • 4
  • 36
  • 75
-1
geocoder.reverseGeocodeCoordinate(coordinate) {(response, error) in 

    if((response?) != nil){
        print(response)
    }

})