Google Places iOS - не удается загрузить результат поиска

Я использую GMSAutoCompleteViewController из Google Places API в своем проекте iOS.

Неожиданно сегодня мой GMSAutoCompleteViewController продолжает выдавать ошибку "Не удается загрузить результаты поиска".

Я восстановил мой ключ API, используя новый. Я перепробовал все, но все же кое-как это не работает.

Я использую Objective-C. Кто-нибудь может помочь?

Код

GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init];
    acController.delegate = self;
[self.navigationController pushViewController:acController animated:YES];

Методы делегирования

- (void)viewController:(GMSAutocompleteViewController *)viewController
                didAutocompleteWithPlace:(GMSPlace *)place {
    // Do something with the selected place.
    NSLog(@"Place name %@", place.name);
    NSLog(@"Place address %@", place.formattedAddress);
    NSLog(@"Place attributions %@", place.attributions.string);
    NSLog(@"Latitude = %.20f",place.coordinate.latitude);
    NSLog(@"Longitude = %.20f",place.coordinate.longitude);
    NSLog(@"Type = %@",place.types);
    NSLog(@"Place ID = %@",place.placeID);
    //[self dismissViewControllerAnimated:YES completion:nil];
    [self.navigationController popViewControllerAnimated:YES];

    /* Call and API in background to get the address according to the new LAT AND LONG as well
     Once get the address from there we can store the latitude and longitude in the cache
     if type of search is Postal code then we have to call another web service i.e. FIND ADDRESS to get the whole exact address */

    [self callWS_ConvertLatLongWithLatitude:[NSString stringWithFormat:@"%.20f",place.coordinate.latitude]
                               andLongitude:[NSString stringWithFormat:@"%.20f",place.coordinate.longitude]
                               inBackground:NO];

}

- (void)viewController:(GMSAutocompleteViewController *)viewController
didFailAutocompleteWithError:(NSError *)error {

    NSLog(@"error: %ld", [error code]);

    [self.navigationController popViewControllerAnimated:YES];

}

// User canceled the operation.
- (void)wasCancelled:(GMSAutocompleteViewController *)viewController {
    NSLog(@"Autocomplete was cancelled.");

    [self.navigationController popViewControllerAnimated:YES];
}

// Turn the network activity indicator on and off again.
- (void)didRequestAutocompletePredictions:(GMSAutocompleteViewController *)viewController {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
}

- (void)didUpdateAutocompletePredictions:(GMSAutocompleteViewController *)viewController {
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
}

1 ответ

После 18 июня 2018 года Google ограничил лимит и изменил политику, вам нужно включить биллинг, после чего он заработает.

Я уже включил API мест Google и API карт Google, но все равно показывал ошибку.

После включения биллинг его решается

Makesure API Google Адресов для IOS включен.

  1. Перейдите на страницу https://console.developers.google.com/apis/
  2. Выберите "Библиотека" - "Google Places API для iOS"
  3. ENABLE (синяя кнопка)

Ключ API такой же, как у Google Maps APIKey

-> Обязательно обновите до последней версии модуля Google Адреса (GooglePlacepicker устарел)

-> Включить API Google Адресов

-> Также проверьте правильность APIKey

Я столкнулся с той же проблемой. Когда я вернулся и снова проверил страницу биллинговой учетной записи, я заметил, что на ней нет моего текущего рабочего проекта. Как только я добавил свой текущий проект, он заработал.

Убедитесь, что ваш текущий проект указан на странице оплаты

Другие вопросы по тегам