ios – Google Locations Autocomplete API returning “The Locations API server returned a response we could not perceive” (Error Code -2)

0
17
ios – Google Locations Autocomplete API returning “The Locations API server returned a response we could not perceive” (Error Code -2)


I am utilizing the Google Locations API in my iOS app to fetch autocomplete recommendations for locations inside a selected geographical area. Nonetheless, I am receiving an error, and I have never been in a position to resolve it. This is the code I am utilizing:

func searchPlaces(question: String) {
        guard !question.isEmpty else {
            self.querylocations = []
            return
        }

        let token = GMSAutocompleteSessionToken()

        let northWestBounds = CLLocationCoordinate2DMake(40.921628, -73.700051)
        let southEastBounds = CLLocationCoordinate2DMake(40.477398, -74.259087)

        let filter = GMSAutocompleteFilter()
        filter.varieties = [kGMSPlaceTypeRestaurant]
        filter.locationBias = GMSPlaceRectangularLocationOption(northWestBounds, southEastBounds)

        let request = GMSAutocompleteRequest(question: question)
        request.filter = filter
        request.sessionToken = token

        GMSPlacesClient.shared().fetchAutocompleteSuggestions(from: request, callback: { ( outcomes, error ) in
            if let error = error {
                print("Autocomplete error: (error)")
                return
            }
            if let autocompleteResults = outcomes {
                for end in autocompleteResults {
                    if let place = consequence.placeSuggestion {
                        self.querylocations.append(Place(identify: place.attributedFullText.string,
                                                         coordinate: CLLocationCoordinate2D(),
                                                         id: place.placeID))
                    }
                }
            }
        })
    }

I am encountering the next error:

Autocomplete error: Error Area=com.google.locations.ErrorDomain Code=-2 “The Locations API server returned a response that we could not perceive. In case you consider this error represents a bug, please file a report utilizing the directions on our group and help web page (https://builders.google.com/locations/ios-sdk/help).” UserInfo={NSLocalizedFailureReason=The Locations API server returned a response that we could not perceive. In case you consider this error represents a bug, please file a report utilizing the directions on our group and help web page (https://builders.google.com/locations/ios-sdk/help)., NSUnderlyingError=0x600000e10ed0 {Error Area=com.google.HTTPStatus Code=403 “Inner Error” UserInfo={NSLocalizedDescription=Inner Error}}}

After reviewing the Google Locations API documentation, I discovered that that is an error associated to inner server points, however I wish to know if anybody has skilled this concern and the way it is likely to be resolved.

What I’ve checked:
My API secret is right and correctly configured.
I’ve ensured that the Locations API is enabled in my Google Cloud Console.
I’ve checked my API utilization quotas and have not exceeded them.
Familiarity with billing: I’ve made certain billing is energetic and related to my undertaking.

Has anybody encountered this earlier than or have any concepts on repair this concern?

LEAVE A REPLY

Please enter your comment!
Please enter your name here