ios - 地方 api 给出内部错误

标签 ios google-places-api ios9.3

操作无法完成。 Places API 库中发生内部错误。如果您认为此错误代表错误,请使用我们社区和支持页面 (https://developers.google.com/places/support) 上的说明提交报告。

我遇到了这个错误。我能够工作几个小时。代码没有任何变化。一段时间后,我收到每个请求的上述错误

我在 iOS 中使用的一些代码

- (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)方法

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

最佳答案

我们需要为 GSMPlacesClient 提供 API_Key,例如 GMSPlacesClient.provideAPIKey("Your_APIKey") 就像我们为 GMSServices 提供的那样

关于ios - 地方 api 给出内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38006596/

相关文章:

ios - desiredAccuracy 会影响区域监控吗?

ios - iOS 中的内存泄漏,AVPlayer 永远不会被释放

安卓 Google Places API "PLACES_API_QUOTA_FAILED"

json - Swift - 解析 JSON 并检索数据

android - 在 Android 中使用 Google Places API

ios - iOS9.3中如何从MKLocalSearchCompletion对象中识别MKMapItem?

ios - 使用 "Allow Arbitrary Loads = YES"阻止应用程序传输安全

ios - UIPickerView 内部静态 UITableViewCell 动画中单元格高度更新问题

ios - Xcode 7.3 缺少私有(private)框架

javascript - react native 导航器 View 不呈现