Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google Places iOS-无法加载搜索结果_Ios_Google Maps_Google Places Api_Gmsautocomplete - Fatal编程技术网

Google Places iOS-无法加载搜索结果

Google Places iOS-无法加载搜索结果,ios,google-maps,google-places-api,gmsautocomplete,Ios,Google Maps,Google Places Api,Gmsautocomplete,我正在iOS项目中使用来自Google Places API的GMSAutoCompleteViewController 今天突然,我的GMSAutoCompleteViewController不断给我错误消息,无法加载搜索结果 我已经使用新的API密钥重新生成了API密钥。我什么都试过了,但还是有些不奏效 我正在使用Objective-C。有人能帮忙吗 代码 委托方法 - (void)viewController:(GMSAutocompleteViewController *)viewCon

我正在iOS项目中使用来自Google Places API的GMSAutoCompleteViewController

今天突然,我的GMSAutoCompleteViewController不断给我错误消息,无法加载搜索结果

我已经使用新的API密钥重新生成了API密钥。我什么都试过了,但还是有些不奏效

我正在使用Objective-C。有人能帮忙吗

代码

委托方法

- (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;
}

确保Google Places API for IOS已启用

去你的房间 选择Library-Google Places API for iOS 启用蓝色按钮
API密钥与Google Maps API密钥相同2018年6月18日之后,Google限制了限额并更改了政策,您需要启用计费,然后才能正常工作

我已经启用了GooglePlacesAPI和GoogleMapAPI,但它仍然显示错误


在启用计费后,它得到了解决

我面临着同样的问题。当我返回并再次检查账单账户页面时,我注意到它没有列出我当前的工作项目名称。 一旦我添加了我当前的项目,它就成功了


确保您当前的项目列在账单页面中

->确保更新到最新版本的Google Places Pod Google PlacesPicker已弃用

->启用Google Places的API


->在获得搜索结果之前,还是在开始时出现此错误时,请检查APIKey是否正确?你是否设置了GMSPlacesClient.providedapikeyapi_KEY_在这里,直到昨天我才能得到搜索结果。今天我突然出错。如果我继续按“重试”,它会显示一些结果列表,我从中选择一个结果,然后再次显示我无法加载搜索结果。我相信您遇到了此处报告的问题:是的,这是同一个问题。我也在谷歌问题追踪网站上报道过。谢天谢地,事情现在解决了-它已经启用了,一段时间它返回数据,但大部分时间没有数据面临相同的问题。它每10次工作一次。无法理解此问题。是否有人找到此问题的其他解决方案?是否有参考文档?
- (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;
}