Fixed
Status Update
Comments
br...@google.com <br...@google.com> #2
I'm going to need help reproducing your issue. I tried the following:
let placesClient = GMSPlacesClient()
placesClient.autocompleteQuery("Ra", bounds: nil, filter: nil) { (results , err) -> Void in
guard err == nil else {
print("Error on autocompleteQuery: \(err)")
return
}
for result in results! {
placesClient.lookUpPlaceID(result.placeID, callback: { (place, err) -> Void in
guard err == nil else {
print("Error on lookUpPlaceID: \(err)")
return
}
print(place?.name)
})
}
}
And the results I get are:
2016-02-16 14:52:43.224 Issue9310[26019:1245048] Google Maps SDK for iOS version: 1.11.21919.0
Optional("Rajasthan")
Optional("Radom")
Optional("Rabat")
Optional("Randburg")
Optional("Ratingen")
let placesClient = GMSPlacesClient()
placesClient.autocompleteQuery("Ra", bounds: nil, filter: nil) { (results , err) -> Void in
guard err == nil else {
print("Error on autocompleteQuery: \(err)")
return
}
for result in results! {
placesClient.lookUpPlaceID(result.placeID, callback: { (place, err) -> Void in
guard err == nil else {
print("Error on lookUpPlaceID: \(err)")
return
}
print(place?.name)
})
}
}
And the results I get are:
2016-02-16 14:52:43.224 Issue9310[26019:1245048] Google Maps SDK for iOS version: 1.11.21919.0
Optional("Rajasthan")
Optional("Radom")
Optional("Rabat")
Optional("Randburg")
Optional("Ratingen")
mi...@gmail.com <mi...@gmail.com> #3
I'm using an address filter, forgot to mention that. My bad.
br...@google.com <br...@google.com> #4
Mmm. I still can't reproduce.
let placesClient = GMSPlacesClient()
let placeFilter = GMSAutocompleteFilter()
placeFilter.country = "IN"
placesClient.autocompleteQuery("Ra", bounds: nil, filter: placeFilter) { (results , err) -> Void in
guard err == nil else {
print("Error on autocompleteQuery: \(err)")
return
}
for result in results! {
placesClient.lookUpPlaceID(result.placeID, callback: { (place, err) -> Void in
guard err == nil else {
print("Error on lookUpPlaceID: \(err)")
return
}
print("\(place!.name) at \(place!.coordinate.latitude),\(place!.coordinate.longitude)")
})
}
}
results in
2016-02-17 11:48:54.912 Issue9310[54163:1399099] Google Maps SDK for iOS version: 1.11.21919.0
Rajkot at 22.3038945,70.8021599
Rajamahendravaram at 17.0005383,81.8040345
Rajasthan at 27.0238036,74.2179326
Raipur at 21.2513844,81.6296413
Ranchi at 23.3440997,85.309562
If you want us to look at this further I suggest you implement a reproduction case by forkinghttps://github.com/domesticmouse/swift-google-map and adding a link to it to this bug. I
let placesClient = GMSPlacesClient()
let placeFilter = GMSAutocompleteFilter()
placeFilter.country = "IN"
placesClient.autocompleteQuery("Ra", bounds: nil, filter: placeFilter) { (results , err) -> Void in
guard err == nil else {
print("Error on autocompleteQuery: \(err)")
return
}
for result in results! {
placesClient.lookUpPlaceID(result.placeID, callback: { (place, err) -> Void in
guard err == nil else {
print("Error on lookUpPlaceID: \(err)")
return
}
print("\(place!.name) at \(place!.coordinate.latitude),\(place!.coordinate.longitude)")
})
}
}
results in
2016-02-17 11:48:54.912 Issue9310[54163:1399099] Google Maps SDK for iOS version: 1.11.21919.0
Rajkot at 22.3038945,70.8021599
Rajamahendravaram at 17.0005383,81.8040345
Rajasthan at 27.0238036,74.2179326
Raipur at 21.2513844,81.6296413
Ranchi at 23.3440997,85.309562
If you want us to look at this further I suggest you implement a reproduction case by forking
mi...@gmail.com <mi...@gmail.com> #5
Hmmm.
Here is the debugPrint of the result. You could just use the this id to call just the lookUpPlaceID.
GMSAutocompletePrediction 0x1288d0fe0: "Raj Bhavan Road, Raj Nagar, Hyderabad, Telangana, India", id: EjdSYWogQmhhdmFuIFJvYWQsIFJhaiBOYWdhciwgSHlkZXJhYmFkLCBUZWxhbmdhbmEsIEluZGlh, types: (
route,
geocode
)
Here is the debugPrint of the result. You could just use the this id to call just the lookUpPlaceID.
GMSAutocompletePrediction 0x1288d0fe0: "Raj Bhavan Road, Raj Nagar, Hyderabad, Telangana, India", id: EjdSYWogQmhhdmFuIFJvYWQsIFJhaiBOYWdhciwgSHlkZXJhYmFkLCBUZWxhbmdhbmEsIEluZGlh, types: (
route,
geocode
)
br...@google.com <br...@google.com> #6
The following code
placesClient.lookUpPlaceID("EjdSYWogQmhhdmFuIFJvYWQsIFJhaiBOYWdhciwgSHlkZXJhYmFkLCBUZWxhbmdhbmEsIEluZGlh", callback: { (place, err) -> Void in
guard err == nil else {
print("Error on lookUpPlaceID: \(err)")
return
}
print("\(place!.name) at \(place!.coordinate.latitude),\(place!.coordinate.longitude)")
})
results in
2016-02-18 12:14:47.556 Issue9310[69521:1493740] Google Maps SDK for iOS version: 1.11.21919.0
Raj Bhavan Road at 17.4160019,78.4609061
I strongly suggest you build a full reproduction case if you want me to look into this further.
me...@chrisbianca.com <me...@chrisbianca.com> #7
I have just stumbled across the same issue when supplying an invalid placeId to the lookUpPlaceID method. Code as follows:
[[GMSPlacesClient sharedClient] lookUpPlaceID:placeId callback:^(GMSPlace * _Nullable place, NSError * _Nullable error) {
if (error) {
NSLog(@"Pick Place error %@", [error localizedDescription]);
}
[self showPlacePicker:place callback:callback];
}];
Supplying a placeId of 1234 results in the callback being invoked twice
[[GMSPlacesClient sharedClient] lookUpPlaceID:placeId callback:^(GMSPlace * _Nullable place, NSError * _Nullable error) {
if (error) {
NSLog(@"Pick Place error %@", [error localizedDescription]);
}
[self showPlacePicker:place callback:callback];
}];
Supplying a placeId of 1234 results in the callback being invoked twice
br...@google.com <br...@google.com>
br...@google.com <br...@google.com> #8
This has been fixed in version 1.13.1. Thanks for working through this with us!
Description
The problem is that the second time the callback is called the error is nil and the returned GMSPlace has nil values
What steps will reproduce the problem? Please provide a link to a
demonstration page if at all possible, or attach code.
1. Use a GMSPlacesClient to search for "Ra"
2. One of the results will be "Raj Bjavan Road"
3. Call lookUpPlaceID with the associated GMSAutocompletePrediction from the previous step
Code snippet:
placesClient.lookUpPlaceID(place.placeID, callback: { (placeDetails: GMSPlace?, error: NSError?) -> Void in
if let error = error {
print("lookup place id query error: \(error.localizedDescription)")
return
}
// for some reason the callback for this function is called twice when it fails to get the place data, so we need to check the placeDetails name and address to see if it's actually valid or else it will trigger a crash
if let placeDetails = placeDetails,
shortAddress = placeDetails.name,
address = placeDetails.formattedAddress {
self.searchTextField.resignFirstResponder()
self.delegate?.didSelectLocation(placeDetails.coordinate, shortAddress: shortAddress, address: address)
}
else {
print("Place details invalid")
}
})
Operating system version: iOS 9
Google Maps SDK for iOS version: 1.11.1
Hardware model: iPhone 6
*********************************************************
For developers viewing this issue: please click the 'star' icon to be
notified of future changes, and to let us know how many of you are
interested in seeing it resolved.
*********************************************************