2017-08-24 13 views
0

iOSプロジェクトのGoogle Places APIからGMSAutoCompleteViewControllerを使用しています。GoogleプレイスiOS - 検索結果を読み込めません

突然、私のGMSAutoCompleteViewControllerが「検索結果を読み込めません」というエラーを表示し続けます。

新しいAPIキーを使用してAPIキーを再生成しました。私はすべてを試しましたが、それでもうまくいかないものもありました。

私はObjective-Cを使用しています。誰も助けることができますか? IOSのための

コード

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; 
} 
+0

検索結果を取得する前に、または起動時にこのエラーが発生する前に?あなたが昨日までにdidFinishLaunchingWithOptions – Govaadiyo

+0

にGMSPlacesClient.provideAPIKey( "API_KEY_HERE")を設定しましたが、検索結果を得ることができました。突然今日、私は間違いを起こしています。 – Shah

+0

「再試行」を押し続けると結果リストが表示され、そこから結果を1つ選択して「検索結果を読み込めません」と表示されます – Shah

答えて

0

Makesure GoogleプレイスAPIが有効になっています。あなたのhttps://console.developers.google.com/apis/

    1. 行く "ライブラリ" を選択してください - "iOS用GoogleプレイスAPIを"
    2. を(青ボタン)を有効enter image description here

      GoogleマップAPIキーと同じよう

    APIキーを

  • 関連する問題