Google Places Api Error in Swift 3 - ios

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
}
})

Related

Issue with AWSCognito/DynamoDB (Unauthenticated access - not supported)

I am trying to use AWSCognito and DynamoDB in an iOS app.
I have followed this document.
appearently with no problem until step 5 (Create a user pool group).
For:
Step 6: Amazon DynamoDB row-level authorization
I don't quite understand what I am supposed to do.
When running this Swift code:
dynamoDbObjectMapper.save(newMyObject!, completionHandler: {
(error: Error?) -> Void in
if let error = error {
print("Amazon DynamoDB Save Error: \(error)")
return
}
print("An item was saved.")
})
I get this error:
Amazon DynamoDB Save Error: Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain
Code=8 "(null)" UserInfo={__type=NotAuthorizedException, message=Unauthenticated
access is not supported for this identity pool.}
But I do not intend to have "Unauthenticated access".
I was expecting to be asked for a username/password at some point.
I must have either done something wrong on the way or not done something I should've done.
The fact is I have no experience setting up AWSCognito/DynamoDB to work together.

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

Firebase customtoken incorrect

Building and ios chat application. Started testing generated a token but when it is passed as customtoken ios throwing error.
FIRAuth.auth()?.signIn(withCustomToken: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyeHAiOjE0ODM4NzEyOTAsInYiOjAsImQiOnsidWlkIjoiNTg0MTVhM2ZkOTA1MGVjZjAzOGI0NWU3In0sImlhdCI6MTQ4MTI3OTI5MH0.QIxFmbap_cDsUB5L_OxE29haev7cSe29lHZtmVTnJ3c") { (user, error) in
if let error = error {
print(error.localizedDescription)
return
}
self.signedIn(user!)
}
The custom token format is incorrect. Please check the documentation.
where as when i test the same token online its working fine.
http://jsfiddle.net/firebase/XDXu5/
Any help will be very helpfull.

Offline sync with Azure App Service

I try to upgrade an objective-c project to Swift. I'm using Azure App Service with a .NET backend to store data from my mobile app (iOS) in the cloud. I just downloaded the quickstart for Swift project from the azure portal and followed the steps in the tutorial to enable offline sync functionality. However inserting an item in the table is not working. I am using the following code to store a new item in the backend
var table : MSSyncTable?
...
self.table!.insert(item) {
(result) in
let syncItem = result.0
let error = result.1
if error != nil {
print("Error: " + error!.localizedDescription)
}
...
}
Stepping through the code at runtime revealed that error is nil so everything should be working fine, but I am not getting a new entry in my table storage.
Does anybody have experience with Azure App Service and Swift and can help me with this?
Because you are using the sync table, the actual operations to send and receive data from the server are explicit. These are represented by the pushWithCompletion:error: method on the sync context (for sending data up to the cloud), and the pullWithQuery:query:queryId:completion: method on your MSSyncTable.
Note that push automatically occurs when you pull as well.
I would expect the code to look something like:
var table : MSSyncTable?
...
self.table!.insert(item) { result in
let syncItem = result.0
let error = result.1
if error != nil {
print("Error: " + error!.localizedDescription)
}
table!.pushWithCompletion() { error in
...
}
...
}

Google Places API Autocomplete not working bad request

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?

Resources