【问题标题】:Google Static Maps API not returning any data谷歌静态地图 API 不返回任何数据
【发布时间】:2023-03-27 12:00:01
【问题描述】:

我正在尝试使用 Google 静态地图 API,但它没有返回任何内容。 API 密钥是正确的,我已成功使用 Google Places API。 IDK我做错了什么。我试过只使用必需的参数,什么也没有。我也尝试过使用 API Docs 中的示例 URL,但也没有。

NSString *url = [NSString stringWithFormat:@"http://maps.googleapis.com/maps/api/staticmap?zoom=18&size=320x120&visual_refresh=true&markers=size:mid|color:0x00AB8B|%f,%f&key=AIzaSyDbg7wrSq-USEJWUqf5TOPepbtGRwbYtg8", [LocationController sharedSingleton].locationManager.location.coordinate.latitude, [LocationController sharedSingleton].locationManager.location.coordinate.longitude];

NSURL *googleURL = [NSURL URLWithString:[url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];

      dispatch_async(kBgQueue, ^{
           NSData* data = [NSData dataWithContentsOfURL: googleURL];
           NSLog(@"data size: %lu", (unsigned long)[data length]);
           if (data.length != 0){
               [mapViewArray addObject:data];
           }
      });

【问题讨论】:

标签: ios objective-c google-maps google-static-maps


【解决方案1】:

想通了。缺少所需的“传感器”参数

【讨论】:

    猜你喜欢
    • 2012-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-06
    • 2017-01-12
    相关资源
    最近更新 更多