小编fri*_*nny的帖子

Google Maps SDK for iOS要求GoogleMaps.bundle成为"复制捆绑资源"下目标的一部分

当我为iOS构建GoogleMaps SDK时,发生了这些错误.

*** Terminating app due to uncaught exception 'GMSException', reason: 'Google Maps SDK for iOS requires GoogleMaps.bundle to be part of your target under 'Copy Bundle Resources''
Run Code Online (Sandbox Code Playgroud)

但是,GoogleMaps.framework在拷贝包资源中.所以,我很困惑.请告诉我这个问题的原因.

iphone xcode google-maps ios google-maps-sdk-ios

63
推荐指数
4
解决办法
4万
查看次数

如何在GMSMapView上设置自定义注释标记(围绕点的动画环)

使用谷歌地图iOS SDK我已经实现了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.icon = [UIImage imageNamed:@"point1.png"]; 

marker.map = mapView_;
Run Code Online (Sandbox Code Playgroud)

但我需要显示动画图像,即要显示的一些图像序列,一个点周围的动画环,而不是原始的GMSMarker

图像序列是point1.png point2.png point3.png point4.png point5.png

任何人都可以帮助我实现这一目标

google-maps objective-c mapkit ios google-maps-sdk-ios

8
推荐指数
1
解决办法
1万
查看次数

如何在GMSMapView上实现GMSMarker拖放?

  1. 我在谷歌地图上设置了标记但是当我拖动它时,所有的地图都是拖动的.

  2. 点击并拖动时我想要拖动标记

  3. 单击并拖动标记外拖动地图.

这是我的代码

self.camera = [GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6 bearing:0 viewingAngle:0];
self.Map = [GMSMapView mapWithFrame:self.MapView.bounds camera:self.camera];
self.Map.myLocationEnabled = YES;
self.Map.delegate = self;

GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = self.camera.target;
marker.draggable = YES;
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = self.Map;
marker.icon = [GMSMarker markerImageWithColor:[UIColor blueColor]];
marker.appearAnimation = kGMSMarkerAnimationPop;

[self.MapView addSubview:self.Map];
Run Code Online (Sandbox Code Playgroud)

这是拖拽事件

- (void) mapView:(GMSMapView *)mapView didBeginDraggingMarker:(GMSMarker *)marker
{

}

- (void) mapView:(GMSMapView *)mapView didEndDraggingMarker:(GMSMarker *)marker
{

}

- (void) mapView:(GMSMapView *)mapView didDragMarker:(GMSMarker *)marker
{

}
Run Code Online (Sandbox Code Playgroud)

当我运行我的应用程序并调试所有上述事件不起作用.但事件点击标记工作很好. …

google-maps drag-and-drop objective-c ios google-maps-sdk-ios

8
推荐指数
1
解决办法
4940
查看次数

无法在Swift AppDelegate文件中访问Google Map Framework

我正在研究Swift,并且正在努力弄清楚如何集成Google Map SDK框架.我在Xcode 6中创建了一个新项目,根据适用于iOS的Google Map SDK说明导入了所需的框架.

但是,当我使用(导入)导入Google Maps框架到AppDelegate.swift文件时,框架无法识别.

无法在任何地方找到解决方案.请帮忙.

google-maps ios google-maps-sdk-ios swift xcode6

8
推荐指数
1
解决办法
5184
查看次数

GMSTileURLConstructor返回缩放的奇怪数据

我正在尝试使用Google在Google地图上绘制自定义叠加层GMSTileURLConstructor.

我使用以下代码来获取我的URL

GMSTileURLConstructor urls = ^(NSUInteger x, NSUInteger y, NSUInteger zoom) {
        NSString *url = @"";

        for (NSDictionary *limits in [selectedPropertyMap objectForKey:@"property_map_zoom_levels"]) {
            int zoomLevel = [[limits objectForKey:@"level"] intValue];
            int tileMinX = 0;
            int tileMaxX = 0;
            int tileMinY = 0;
            int tileMaxY = 0;

            if ([limits objectForKey:@"tile_min_x"] != (id)[NSNull null]) {
                tileMinX = [[limits objectForKey:@"tile_min_x"] intValue];
            }
            if ([limits objectForKey:@"tile_max_x"] != (id)[NSNull null]) {
                tileMaxX = [[limits objectForKey:@"tile_max_x"] intValue];
            }
            if ([limits objectForKey:@"tile_min_y"] != (id)[NSNull null]) { …
Run Code Online (Sandbox Code Playgroud)

google-maps ios google-maps-sdk-ios

6
推荐指数
1
解决办法
744
查看次数

GMSMapView myLocation点与自定义引脚重叠

我正在iOS项目中使用GoogleMaps SDK. myLocationEnabled属性设置为YES.我希望用户定位引脚悬停在所有其他引脚上,就像在Android上一样.但由于某种原因,它与其他地图引脚重叠. 在此输入图像描述 谷歌搜索没有给我任何有类似问题的人.我该怎么办?在地图上添加引脚时,我正在使用标准的GMSMapView工作流程.

GMSMarker * marker = [[GMSMarker alloc]init];
CLLocationCoordinate2D coordinate;
//cluster - is just an object of business logic
coordinate.latitude = [cluster.latitude floatValue];
coordinate.longitude =[cluster.longitude floatValue];
[marker setIcon:markerIcon];
[marker setPosition:coordinate];
[marker setUserData:cluster];
[marker setMap:mapView_];
Run Code Online (Sandbox Code Playgroud)

google-maps ios google-maps-sdk-ios

6
推荐指数
0
解决办法
660
查看次数

如何限制谷歌地图视图从平移超出提供的坐标范围?

我在ios中使用谷歌地图sdk.我想限制用户查看除允许他查看的状态之外的其他状态.在地图上查看的允许区域以坐标(FarRight纬度和经度),(近纬度和经度)和(中心纬度和经度)给出.

- - - X


- -X - -


X - - -

  • X标记大地图上允许的地图坐标.

当用户将地图平移到此边界外的坐标时,必须将其平移回旧位置.但问题是,在google maps SDK中, - (void)mapView:(GMSMapView*)mapView didChangeCameraPosition:(GMSCameraPosition*)position上面的方法给出了可见地图坐标的位置.从属性"位置",我们只能获得目标中心坐标而不是边界坐标.如何解决这个问题?

谢谢.

google-maps objective-c ios google-maps-sdk-ios

5
推荐指数
0
解决办法
821
查看次数

如何使用Google Maps ios SDK跟踪用户的位置并显示行进路径

我目前正在构建一个ios应用程序,我希望实现一个功能,其中用户的位置显示在Google Map视图上,当他们移动折线显示时,用户到目前为止已经行进的路径.这显然需要实时发生.

到目前为止,我已经初始化了Google地图视图,并可以使用observeValueForKeyPath函数显示用户的当前位置.用户移动时视图和位置标记会更新.

我认为最好的方法是创建一个GMSMutablePath对象,每次地图相机更新到新位置时添加用户的当前位置,然后从该路径创建折线.我用于此的代码如下:

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    if ([keyPath isEqualToString:@"myLocation"] && [object isKindOfClass:[GMSMapView class]])
    {
        [self.myMapView animateToCameraPosition:[GMSCameraPosition cameraWithLatitude:self.myMapView.myLocation.coordinate.latitude
                                                                                 longitude:self.myMapView.myLocation.coordinate.longitude
                                                                                      zoom:18]];


        [trackedPath addCoordinate:CLLocationCoordinate2DMake(self.myMapView.myLocation.coordinate.latitude, self.myMapView.myLocation.coordinate.longitude)];
        GMSPolyline *testPoly = [GMSPolyline polylineWithPath:trackedPath];
        testPoly.strokeWidth = 8;
        testPoly.strokeColor = [UIColor redColor];
        testPoly.map = myMapView;
    }
}
Run Code Online (Sandbox Code Playgroud)

这在实践中不会在地图上产生任何折线,所以任何帮助/建议将非常感谢!

google-maps polyline ios google-maps-sdk-ios

5
推荐指数
1
解决办法
7169
查看次数

如何为Google Maps IOS设置可见区域/缩放级别以显示所有添加到Mapview的标记

我在ios应用中使用过Google地图,我想根据我在地图上进行的搜索动态设置缩放级别。基本上是通过搜索城市名称或经纬度查询来添加图钉。每次搜索后都添加了图钉,我需要通过我最近进行的搜索显示所有添加的标记。

google-maps ios google-maps-sdk-ios

5
推荐指数
2
解决办法
3515
查看次数

iOS:动态标记信息窗口

我正在尝试将图像动态加载到信息窗口中。问题是 SDWebImage 永远不会完成。但是,一旦我再次单击标记,图像就会显示并完成,但不会在第一次被调用。我的“运行”日志第一次显示,所以我知道代码正在被调用,但在第一次运行时不会显示完整,除非图像被缓存,在这种情况下它会显示在第二个标记点上。

旁注:我将图像的链接存储在片段中,因为我没有其他用途。

任何想法为什么 SDWebImage 不完整?或者有没有其他人能想到的更好的方法?

我在文档块下看到的最后一件事它说以下似乎适合但我不知道我是如何取消请求以导致这种行为的。

注意:如果您的图像请求在完成之前被取消,则不会调用您的成功块和失败块。

bool tapped = NO;

-(BOOL) mapView:(GMSMapView *) mapVieW didTapMarker:(GMSMarker *)marker{
    tapped=YES;
    [mapVieW setSelectedMarker:marker];
    return YES;
}

- (UIView *)mapView:(GMSMapView *)mapVieW markerInfoWindow:(GMSMarker *)marker{
    if([marker.snippet isEqualToString:@""] || [marker.snippet isEqualToString:nil]){
        //no image
        tapped = NO;
        //code here
        return view;
    }else{
        //image
        //code for custom view which is unimportant
        if(tapped){
            NSLog(@"run");
            [image setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", URL_PREFIX, marker.snippet]] placeholderImage:[UIImage imageNamed:@"you"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
                NSLog(@"complete");
                tapped=NO;
                [mapView setSelectedMarker:nil];
                [mapView setSelectedMarker:marker];
            }]; …
Run Code Online (Sandbox Code Playgroud)

google-maps infowindow marker ios google-maps-sdk-ios

5
推荐指数
0
解决办法
1011
查看次数