Google Places API Autocomplete not working bad request - ios

I'm trying to use Google places API to get autocomplete.
I've checked everything:
API keys are activated (disabled every restriction)
I'm calling GMSServices.provideAPIKey and GMSPlacesClient.provideAPIKey
Initializing the object placesClient = GMSPlacesClient.shared()
The call I'm making is:
let filter = GMSAutocompleteFilter()
filter.type = .establishment
placesClient?.autocompleteQuery(textField.text!, bounds: nil, filter: filter) { (predictionList, error) in
if let error = error {
print("Pick Place error: \(error.localizedDescription)")
return
}
if let list = predictionList{
self.resultList = list
}
}
The error I'm getting is:
Printing description of error: Error
Domain=com.google.places.ErrorDomain Code=-3 "An internal error
occurred in the Places API library. If you believe this error
represents a bug, please file a report using the instructions on our
community and support page
(https://developers.google.com/places/support)."
UserInfo={NSLocalizedFailureReason=An internal error occurred in the
Places API library. If you believe this error represents a bug, please
file a report using the instructions on our community and support page
(https://developers.google.com/places/support).,
NSUnderlyingError=0x608000445370 {Error
Domain=com.google.places.server.ErrorDomain Code=-1 "(null)"
UserInfo={NSUnderlyingError=0x60800024f030 {Error
Domain=com.google.GTLRErrorObjectDomain Code=400 "(Bad Request)"
UserInfo={error=Bad Request, GTLRStructuredError=GMSx_GTLRErrorObject
0x60800024f9f0: {message:"Bad Request" errors:[1] code:400},
NSLocalizedFailureReason=(Bad Request)}}}}}
Has anyone else seen this problem in Xcode 8 iOS 10? Thanks
EDIT: Now it seems that some requests are working... Maybe the server is having problems?

Related

Disabled Facebook Login iOS throws com.facebook.sdk.core Code=8

Our App was disabled a week ago due to violation on 6.1 and we tried to fix the issue
I have tried reimplementing the login following the instructions on the Facebook login setup guide. Also tried updating from 9.0.1 to the latest version 12.1.0
I can confirm that the info.plist is correct, the permissions are correct, bundle id is correct, and we only use test accounts.
However this error still throws, I could not find any references to fix this.
Could anyone help?
Don't know if this helps but the android app using version 5.4.0 build is working fine
Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={NSRecoveryAttempter=<_FBSDKTemporaryErrorRecoveryAttempter: 0x1630097f0>, NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again., com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Unsupported request, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCodeKey=1, NSLocalizedRecoveryOptions=(
OK
), com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 1;
"fbtrace_id" = ANc5PSXRGPTACuYqqxYTDda;
message = "Unsupported request";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:FBSDKGraphRequestErrorKey=1}
From your error response, it seems like you are requesting data from a not-existing API or that your token is invalid
error = {
code = 1;
"fbtrace_id" = ANc5PSXRGPTACuYqqxYTDda;
message = "Unsupported request";
type = OAuthException;
};
from Facebook's docs: OAuthException | code= 1
//API Unknown//
Possibly a temporary issue due to downtime. Wait and retry the operation. If it occurs again, check that you are requesting an existing API.

Not able to sign in with AWSMobileClient iOS. Getting AWSMobileClientError error 13

I'm using the AWSMobileClient on iOS for authentication and I'm not able to sign in. I'm calling the signin method and all I'm getting is the following error:
The operation couldn’t be completed. (AWSMobileClient.AWSMobileClientError error 13.)
This error is useless to me and I can't find any decent documentation on what this error means. Has anyone seen this? Appreciate your help.
Please take a look at this https://github.com/aws-amplify/aws-sdk-ios/issues/1538#issuecomment-491905913
You can cast the error as AWSMobileClientError and switch on it to exhaust the list of errors.
Alternatively, I've moved over the internal message property over to my app like this:
https://github.com/lawmicha/iOS-User-Authentication-with-Email-Facebook-Google/blob/master/AmplifyUserAuthentication1/Internal/ErrorMapper.swift
extension AWSMobileClientError {
var message: String {
switch self {
case .aliasExists(let message),
.badRequest(let message),
and then I can access the message on error after casting it to AWSMobileClientError from if let error = error as? AWSMobileClientError
You should keep in mind that the alternative method exposes the message which is a developer facing message and not a end-user facing message. Ideally when you need to provide an end-user facing message, you would use first method and map the error case to a specific localized message.

GooglePlaces API "Response That We Couldn't Understand" Error

Using the standard autocomplete code with a searchbar:
placesClient.autocompleteQuery(searchBar.textField.text!, bounds: nil, filter: filter, callback: {(results, error) -> Void in
if let error = error {
print("Autocomplete error \(error)")
return
}
if let results = results {
for result in results {
print("Result \(result.attributedFullText) with placeID \(result.placeID)")
self.predictions.append(result)
}
}
self.placesTableView.reloadData()
})
Has been working for months and tonight it started reporting this error:
Autocomplete error Error Domain=com.google.places.ErrorDomain Code=-2 "The Places API server returned a response that we couldn't understand. If you believe this error represents a bug, please file a report using the instructions on our community and support page (https://developers.google.com/places/support)."
UserInfo={NSLocalizedFailureReason=The Places API server returned a response that we couldn't understand. If you believe this error represents a bug, please file a report using the instructions on our community and support page (https://developers.google.com/places/support)., NSUnderlyingError=0x600000444380 {Error Domain=com.google.places.server.ErrorDomain Code=-1 "(null)" UserInfo={NSUnderlyingError=0x600000444350 {Error Domain=com.google.HTTPStatus Code=404 "Not Found" UserInfo={NSLocalizedDescription=Not Found}}}}}
Anyone else experiencing this?
Looks like the service is back up. I raised a ticket with Google.
They identified the issue and are resolving it. Mentioned it could take a few hours.
See below:
https://issuetracker.google.com/issues/64280749
https://issuetracker.google.com/issues/64994023
This issue has been filed with Google, Google has identified the bug, and they are currently working on a fix. Issue tracking: https://issuetracker.google.com/issues/64280749
See: why loading places in iOS using google places api causes lookup place id query error?
thank-you: #trishcode

Swift Gmail API: Try to send message gives error -1001

I'm trying to send a gmail message in Swift using the GoogleAPIClientForREST and GTMOAuth2 libraries but I'm getting the aforementioned error.
Here's my code:
let message = GTLRGmail_Message()
message.raw = "test"
let query = GTLRGmailQuery_UsersMessagesSend.query(withObject: message, userId: "example#gmail.com", uploadParameters: nil)
let gmailService = GTLRGmailService()
let auth = GTMOAuth2Authentication()
auth.clientID = gmailClientID
gmailService.authorizer = auth
gmailService.executeQuery(query) { ticket, object, error in
print(ticket)
print(object)
print(error)
}
and here's the error:
Optional(Error Domain=com.google.GTMOAuth2 Code=-1001 "(null)" UserInfo={request=<NSMutableURLRequest: 0x600000016ed0> { URL: https://www.googleapis.com/gmail/v1/users/example%40gmail.com/messages/send?prettyPrint=false }})
Notes:
I used "example#gmail.com" for sake of asking the question, I'm using a real email in my app.
I followed all the basic steps in Google's tutorial
Make sure that you've integrated GTMOAuth2 properly into your app by following this tutorial. Be sure to register the Platform as Other and NOT iOS otherwise you'll get "invalid_client" error when authenticating.
You may also check the given solution on this thread.

Google Places Api Error in Swift 3

Google Places Api
I am implementing google place api in my project. I have implemented everything but google Api returns the following error:
Current Place error: The operation couldn’t be completed. An internal
error occurred in the Places API library. If you believe this error
represents a bug, please file a report using the instructions on our
community and support page
(https://developers.google.com/places/support).
It was working earlier but suddenly it stops. I found nothing in any other answer that could be helpful for me.
This my code to call the Api:
GMSPlacesClient().currentPlace(callback: {
(placeLikelihoods, error) -> Void in
guard error == nil else {
print("Current Place error: \(error!.localizedDescription)")
return
}
})
Any Help would be appreciated!!
Make sure that you have given place_id instead of id.
This solved my issue
According to the GMSPlacesClient reference (https://developers.google.com/places/ios-api/reference/interface_g_m_s_places_client) you should be accessing the shared instance of the client, so in Swift 3 your code above should be
GMSPlacesClient.shared().currentPlace(callback: {
(placeLikelihoods, error) -> Void in
guard error == nil else {
print("Current Place error: \(error!.localizedDescription)")
return
}
})

Resources