-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Error :- GooglePlaces API Error: REQUEST_DENIED #42
Comments
@watsonbox , In swift 3 and ios 10 I am also getting the same error. Previously it used to work fine |
The same problem for me. |
It seems that I have tracked down the problem. It was related to escaping of optional query parameters. Here is the solution (I have rewritten the origin functions): fileprivate class func query(_ parameters: [String: AnyObject]) -> String {
var components: [(String, String)] = []
for key in Array(parameters.keys).sorted(by: <) {
if let value = parameters[key] as? String {
let escapedValue = escape(value)
components += [(escape(key), escapedValue)]
}
}
return (components.map{"\($0)=\($1)"} as [String]).joined(separator: "&")
}
fileprivate class func escape(_ string: String) -> String {
var escapedCharacters = CharacterSet.urlQueryAllowed
escapedCharacters.remove(charactersIn: ":/?&=;+!@#$()',*")
return string.addingPercentEncoding(withAllowedCharacters: escapedCharacters) ?? ""
} |
Or like this works too |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
While searching any thing getting error :- GooglePlaces API Error: REQUEST_DENIED
We added our API key properly and follow the below :-
Manual
Simply copy GooglePlacesAutocomplete.swift and GooglePlacesAutocomplete.xib to your project.
Note: Don't forget to add the PoweredByGoogle image to your xcassets.
Thanks,
The text was updated successfully, but these errors were encountered: