In my iOS app, I have the Google Maps SDK and I am using a GMSPlacePicker to pick a place around specific coordinates like this:
//center is a CLLocationCoordinate2D
CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(center.latitude + 0.001,center.longitude + 0.001);
CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(center.latitude - 0.001,center.longitude - 0.001);
GMSCoordinateBounds *viewport = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast coordinate:southWest];
GMSPlacePickerConfig *config = [[GMSPlacePickerConfig alloc] initWithViewport:viewport];
_placePicker = [[GMSPlacePicker alloc] initWithConfig:config];
[_placePicker pickPlaceWithCallback:^(GMSPlace *place, NSError *error) {
if (error != nil) {
NSLog(@"Pick Place error %@", [error localizedDescription]);
}
else if (place) {
CLLocationCoordinate2D c = place.coordinate;
//place.coordinate doesn't exist
}
}];
however there is no place.coordinate property despite Google stating there is here Any ideas why this is missing ?
I'm working in Swift, but this might be helpful. The 'coordinates' property of GMSPlace comes up as an optional, so it may not be required to have a value. Can you check its existence?
As a workaround, I'm looking up the coordinate using a 'lookupPlaceID' call based on the 'googlePlaceID', but it costs an additional API call.