Reputation: 1093
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).
I am getting this error. I was able to work for some hours . Nothing changed in code. After some time i am getting the above error for every request
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
NSString *text = [textField text];
text = [text stringByReplacingCharactersInRange:range withString:string];
if (text.length>0) {
footerView.hidden = NO;
[footerView startAnimating];
}else {
[self removeDropDown];
return YES;
}
[_fetcher sourceTextHasChanged:text];
return YES;
}
Delegate methods
- (void)didAutocompleteWithPredictions:(NSArray *)predictions {
resultsArray = [[NSMutableArray alloc]init];
NSMutableArray *titlesArray = [[NSMutableArray alloc]init];
for (GMSAutocompletePrediction *prediction in predictions) {
[titlesArray addObject:[prediction.attributedPrimaryText string]];
[resultsArray addObject:prediction];
}
if (self.searchTextField.text.length>0) {
if (dropDown == nil) {
dropDown = [[PTDropDownView alloc] showDropDown:self.searchParentView withheight:autoCompleteViewMaxHeight withItems:titlesArray animationDirection:DirectionDown];
dropDown.delegate = self;
} else {
dropDown.itemsArray = titlesArray;
[dropDown.tableView reloadData];
}
dropDown.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.4];
[self adjustDropDownFrame];
[footerView stopAnimating];
}
NSLog(@"fetched count = %d",resultsArray.count);
}
- (void)didFailAutocompleteWithError:(NSError *)error {
NSLog(@"%@",[NSString stringWithFormat:@"%@", error.localizedDescription]);
[self removeDropDown];
}
Upvotes: 0
Views: 2293
Reputation: 1093
After some days i come to know that it will give the results for certain number of searches per a day. I got the above error in one day. In next day without code change that is working.
Upvotes: 0
Reputation: 1191
we need to provide API_Key for GSMPlacesClient like GMSPlacesClient.provideAPIKey("Your_APIKey")
just like we go it for GMSServices
Upvotes: 1
Reputation: 901
I was able to resolve the error by ensuring that an empty query was not being sent. Note that I am not using the GMSAutoCompleteFetcher() wrapper and instead using a shared GMSPlacesClient to fetch predictions.
Swift 2:
func autocompleteQuery(withQuery query: String) {
if !query.isEmpty {
placesClient.autocompleteQuery(query, bounds: self.bounds, filter: .None) { results, error in
guard error == nil else {
print("Autocomplete error \(error)")
return
}
self.predictions = results!
dispatch_async(dispatch_get_main_queue()) { self.autocompleteResultsTableView.reloadData() }
}
}
}
Upvotes: 0