google-maps - Places API 库中发生内部错误

标签 google-maps maps cocoapods google-places-api google-places

我正在使用 GoogleMaps 和 GooglePlaces API,但我总是遇到同样的错误。

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

我尝试运行 pod try GoogleMaps,当我启动 de project 时,加载了任何 map ,只有一个具有不同选项的 tableView。

这是我的代码,我只想获取用户位置:

-(IBAction)getCurrentPlace:(UIButton *)sender {
[placesClient currentPlaceWithCallback:^(GMSPlaceLikelihoodList *placeLikelihoodList, NSError *error){
    if (error != nil) {
        NSLog(@"Pick Place error %@", [error localizedDescription]);
        return;
    }

    self.nameLabel.text = @"No current place";
    self.addressLabel.text = @"";

    if (placeLikelihoodList != nil) {
        GMSPlace *place = [[[placeLikelihoodList likelihoods] firstObject] place];
        if (place != nil) {
            self.nameLabel.text = place.name;
            self.addressLabel.text = [[place.formattedAddress componentsSeparatedByString:@", "]
                                      componentsJoinedByString:@"\n"];
        }
    }
}];
}

我在 didFinishLaunchingWithOptions 中导入了 mi APIKEY

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[GMSServices provideAPIKey:@"MY_APIKEY"];

return YES;
}

这是我的 Podfile

platform :ios, '7.0'
source 'https://github.com/CocoaPods/Specs.git'

target ‘googlePlace’ do

   pod 'GoogleMaps'
   pod 'GooglePlaces'

end

最后,我的 apikey 在 Google 控制台中配置到 iOS 应用程序。

有什么问题??

最佳答案

您的 API key 似乎无效或超出配额。

您能检查一下您是否将正确的 API key 传递给了 GMSPlacesClient.provideAPIKey(_:)。

如果您确定传递的是正确的 API key ,请检查 Google API 控制台 (https://console.developers.google.com/) 以确保您没有超出每日配额限制。

可以在此处跟踪此问题:https://issuetracker.google.com/issues/35830792

关于google-maps - Places API 库中发生内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40018588/

相关文章:

ios - 如何创建使用另一个框架的动态框架

android - 在 Android 应用程序中集成语音导航

javascript - Google Places API 未加载

javascript - 如何在没有 API key 的情况下使用谷歌地图

html - 谷歌地图代码上的声音

swift - 如何将 Alamofire pod 添加到 Apple Watch 扩展?

java - 在 java 中为谷歌地图引擎创建一个引擎对象

r - R中具有 map 和图层的ggplot2 stat_density2d的透明度和Alpha级别

java - 如何保留带有键和集合列表的 map ?

cocoa - 使用cocoapods添加测试库时出现dyld库错误