googlemaps / ios-places-sdk

Apache License 2.0
9 stars 2 forks source link

Error when selecting a place using GMSAutocompleteViewController in Google Place SDK v9 #11

Open behzadardehei opened 2 weeks ago

behzadardehei commented 2 weeks ago

Environment details

  1. API: Places
  2. OS type and version: iOS 17.5
  3. Library version and other environment information: Google Place SDK v9

Steps to reproduce

  1. Update Google Place SDK to version 9.
  2. Use GMSAutocompleteViewController to display places.
  3. Select a place from the list.
  4. Observe the error.

Code example

    @IBAction func tapEnterAddress(_ sender: UITapGestureRecognizer) {
        let autocompleteController = GMSAutocompleteViewController()
        autocompleteController.delegate = self

        present(autocompleteController, animated: true, completion: nil)
    }

Stack trace Error Domain=com.google.HTTPStatus Code=403 "Internal Error" UserInfo={NSLocalizedDescription=Internal Error}

Description: I have recently updated the Google Place SDK to version 9 and am using GMSAutocompleteViewController to display places. However, when I select a place, I encounter the following error: Error Domain=com.google.HTTPStatus Code=403 "Internal Error" UserInfo={NSLocalizedDescription=Internal Error}

All configurations on the Google Cloud side are correct. Additionally, when I downgrade to version 8.5.0, everything works fine without any errors.

goota72 commented 1 week ago

Same problem.

Environment details

  1. API: Places
  2. OS type and version: iOS 17.5
  3. Library version and other environment information: Google Place SDK v9
  4. Use GMSAutocompleteViewController

It works when I enable the Places API (New) on Google Maps Platform, but unnecessary Place Detail fields that is not specified in placeFields is also retrieved.

placeFields sample

autocompleteController.placeFields =  GMSPlaceField(rawValue:   
              GMSPlaceField.name.rawValue |  
              GMSPlaceField.placeID.rawValue |  
              GMSPlaceField.formattedAddress.rawValue |  
              GMSPlaceField.coordinate.rawValue)  



didAutocompleteWith delegate (place: GMSPlace) contains all fields.

eg) 
....
_website    NSURL?  "https://map.mcdonalds.co.jp/map/14044" 0x000000028034c460
_placeID    __NSCFString *  "ChIJh068ramqGWARj6lZENZoqzM"   0x000000028241efd0
_attributions   id  0x0 0x0000000000000000
_types  __NSFrozenArrayM *  0x28241c960 0x000000028241c960
_addressComponents  __NSFrozenArrayM *  0x28241c930 0x000000028241c930
_viewportInfo   GMSPlaceViewportInfo?   0x000000028241c7b0
_photos __NSArrayM *    10 elements 0x000000028241d920
_businessStatus long long   1
_iconBackgroundColor    UIDeviceRGBColor?   0x000000028310b1c0
_iconImageURL   NSURL?  "https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet.png"    0x000000028034c4d0
_takeout    long long   1
_delivery   long long   1
_dineIn long long   1
_curbsidePickup long long   1
_reservable long long   0
_servesBreakfast    long long   1
_servesLunch    long long   1
_servesDinner   long long   1
_servesBeer long long   2
_servesWine long long   2
_servesBrunch   long long   0
_servesVegetarianFood   long long   2
....