我正在使用适用于iOS的Google Maps SDK的当前版本1.1.2.地图仅显示Google徽标,当前位置和添加的标记.但是没有任何地图内容:

我正确注册了API密钥:
BOOL result = [GMSServices provideAPIKey:@"<my key>"];
Run Code Online (Sandbox Code Playgroud)
结果是YES,我验证了bundleIdentifier与API控制台匹配.我从故事板加载GMSMapView并将相机设置为-viewDidLoad:
self.mapView.camera = [GMSCameraPosition cameraWithLatitude:0 longitude:0 zoom:2];
Run Code Online (Sandbox Code Playgroud)
这由GMSMapView记录:
Failed to make complete framebuffer object 8cd6
Failed to make complete framebuffer object 8cd6
Google Maps SDK for iOS version: 1.1.2.2533
GMSZoomTableQuadTree lacks root zoom table for tile type (mapType: 10)
GMSZoomTableQuadTree lacks root zoom table for tile type (mapType: 15)
Run Code Online (Sandbox Code Playgroud)
知道什么可能导致这个问题吗?
使用Google Maps for iOS SDK,"我的位置"按钮默认位于右下角:

我想将它放在左下角(是的,我意识到我需要注意不要遮挡那里的"Google"徽标).我不相信SDK有"官方"方式这样做,但根据这个答案我已经想出如何抓住我的位置按钮子视图,以便我可以定位它.
让我感到困惑的部分是我应该给"我的位置"视图的框架和/或边界提供的值,以便将它放在我想要的位置.首先,当前的"我的位置"按钮有frame.origin.x= -74和frame.origin.y= -54.这是我第一次看到a frame.origin.x或a的负坐标frame.origin.y,我甚至不确定iOS如何处理负坐标.我的第一个想法是,例如frame.origin.x = -74相当于[view superview].frame.size.width - 74,即从超视图的宽度或高度中减去负值.但后来我看了superview的宽度和高度,他们都是0.0.这是我的代码,它输出有关地图和我的位置按钮框架和边界的一些信息:
- (void)loadView {
GMSCameraPosition *cam = [GMSCameraPosition cameraWithLatitude:jcuTownsvilleCenterCampusLat longitude:jcuTownsvilleCenterCampusLon zoom:17];
self.campusMap = [GMSMapView mapWithFrame:CGRectZero camera:cam];
self.campusMap.myLocationEnabled = YES;
self.campusMap.settings.myLocationButton = YES;
self.view = self.campusMap;
for (UIView *view in self.campusMap.subviews) {
NSLog(@"view.description: %@",view.description);
if ([view isKindOfClass:[UIButton class]]) {
// these four values in the conditional below are just what …Run Code Online (Sandbox Code Playgroud) 我目前正在我的项目中使用Google Maps API.我正在尝试将默认相机/缩放设置为用户位置.我这样做:
@implementation ViewController{
GMSMapView *mapView_;
}
@synthesize currentLatitude,currentLongitude;
- (void)viewDidLoad
{
[super viewDidLoad];
mapView_.settings.myLocationButton = YES;
mapView_.myLocationEnabled = YES;
}
- (void)loadView{
CLLocation *myLocation = mapView_.myLocation;
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(myLocation.coordinate.latitude, myLocation.coordinate.longitude);
marker.title = @"Current Location";
marker.map = mapView_;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:myLocation.coordinate.latitude
longitude:myLocation.coordinate.longitude
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
self.view = mapView_;
NSLog(@"%f, %f", myLocation.coordinate.latitude, myLocation.coordinate.longitude);
}
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用,因为当我这样做
NSLog(@"%f, %f", myLocation.coordinate.latitude, myLocation.coordinate.longitude);
Run Code Online (Sandbox Code Playgroud)
它返回0,0,并且它不给出当前位置坐标.如何正确获取用户的坐标?
有没有办法从GMSMapView中删除GMSPolygons?
它似乎不存在包含它们的GMSMapView的属性(作为GMSPlolyLines),我是否应该清除地图并再次渲染所有?
谢谢
我将浏览Google Maps SDK for iOS入门页面,了解如何在给定边界上缩放和居中视图.Build a GMSCameraPosition中提供了此代码,其中提到"移动相机有时会使整个感兴趣区域以最大可能的缩放级别可见".
此措辞类似于通过GMSCameraUpdate的另一种可能方法,"返回一个GMSCameraUpdate,它可以转换摄像机,使指定的边界在屏幕上以最大可能的缩放级别居中."
下面的代码直接来自"入门"页面中的两个链接 - 稍微调整以提供有意义的屏幕截图; 适应性对实际结果没有影响.
- (void)loadView
{
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
CLLocationCoordinate2D vancouver = CLLocationCoordinate2DMake(49.26, -123.11);
CLLocationCoordinate2D calgary = CLLocationCoordinate2DMake(51.05, -114.05);
GMSMarker *vancouverMarker = [[GMSMarker alloc] init];
vancouverMarker.position = vancouver;
vancouverMarker.title = @"Vancouver";
vancouverMarker.map …Run Code Online (Sandbox Code Playgroud) 我试图运行基本的iOS演示SDK代码.我已经创建了API密钥并且加载正常.虽然我已经将viewDidLoad中的代码转移到了loadView,但效果仍然存在.请参阅以下代码
-(void)loadView{
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
_mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
_mapView.myLocationEnabled = YES;
self.view = _mapView;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = _mapView;
}
Run Code Online (Sandbox Code Playgroud)
相机已创建,但执行此行时
_mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
Run Code Online (Sandbox Code Playgroud)
使用描述抛出NSException - > - [GMSMapView animateToCameraPosition:]:发送到实例的无法识别的选择器. …
我正在尝试通过CocoaPods为我正在开发的Swift项目添加Google Maps SDK for iOS,因为CocoaPods现在支持Swift.
这是我的podfile.
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '7.0'
pod 'Google-Maps-iOS-SDK'
Run Code Online (Sandbox Code Playgroud)
Pod安装成功完成,我可以导入这样的框架,import GoogleMaps没有任何编译错误.
但后来我继续添加了一个UIView并将其类设置为GMSMapView并将IBOutlet添加到我的视图控制器并构建项目.我收到以下错误.
链接器命令失败,退出代码为1(使用-v查看调用)

我已经添加并使用了Objective-C中编写的库,如MagicalRecord,MBProgressHUD在Swift项目上没有任何问题.
我也在这里上传了一个演示Xcode项目.
有什么办法解决这个问题?
我正在使用Google Maps SDK在我的iOS应用中显示地图.实际上,在以前的iOS版本(<= 8.1)中,当前位置的默认蓝色图标显示正确,但现在在iOS 8.2模拟器中,蓝点看起来像这样
.
我正在按照谷歌地图SDK文档中的确切步骤操作
要显示我刚刚做的当前位置:
mapView.myLocationEnabled = true
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
我希望能够在不改变地图位置的情况下更改GMSMapView的填充.现在,Google Maps iOS SDK会更改地图位置,以便在应用填充后相同的点位于中心.这与Android SDK的工作方式不同,后者只是保留了地图.
我已经找到了一个轻微的解决方法,但它不能始终如一地工作.我可以计算新的中心位置应该是什么,并在我用以下更改填充时更新地图相机...
UIEdgeInsets oldPadding = self.mapCtrl.map.padding;
UIEdgeInsets newPadding = UIEdgeInsetsMake(top, left, bottom, right);
float deltaX = ((newPadding.right - newPadding.left)/2 - (oldPadding.right-oldPadding.left)/2);
float deltaY = ((newPadding.top - newPadding.bottom)/2 - (oldPadding.top-oldPadding.bottom)/2);
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate scrollByX:deltaX Y:deltaY];
[self.mapCtrl.map setPadding:newPadding];
[self.mapCtrl.map moveCamera:updatedCamera];
Run Code Online (Sandbox Code Playgroud)
但我会说它只能达到50%.另外50%的地图移动到新的填充位置,然后返回到我想要的位置.
我看到了两个可能的解决方案... A)以不同的方式更改填充,以便它不移动地图,或B)找出一种方法来通过某种方式暂停或分组地图运动来使上述代码工作这样两个电话只能立刻通过.但我无法弄清楚如何使这两件事发生.
我有这个代码打开具有特定位置的Google Maps App并且它正在运行但我需要的是在该位置放置一个引脚,是否可能?
if (UIApplication.shared.canOpenURL(URL(string:"comgooglemaps://")!)) {
UIApplication.shared.openURL(URL(string:
"comgooglemaps://?center=\(self.location.coordinate.latitude),\(self.location.coordinate.longitude)&zoom=14&views=traffic")!)
} else {
print("Can't use comgooglemaps://");
}
Run Code Online (Sandbox Code Playgroud)
怎么做?
ios ×8
google-maps ×6
swift ×3
objective-c ×2
cocoapods ×1
ios7 ×1
ios8.2 ×1
iphone ×1
location ×1
xcode5 ×1