Tag: 谷歌地图 SDK IOS

Google Maps iOS SDK崩溃

我使用谷歌地图iOS SDK与故事板。 从具有根视图控制器和导图的导航视图控制器开始的应用程序。 @implementation MyViewController @synthesize btnMyLock; @synthesize btnNearby; GMSMapView *mapView_; – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:20 longitude:20 zoom:0]; mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; mapView_.myLocationEnabled = YES; self.view = mapView_; // Creates a marker in the center of […]

EXC_BAD_ACCESS使用在8.3设备上运行的gmaps sdk 1.9.0,Xcode 6.4

我有2个项目与谷歌地图SDK工作,他们目前在AppStore。 要记住的事情: 通过cocoapods安装Gmaps sdk 1.9.0版 Xcode版本6.4 部署目标7.1 设备:iPhone 4与8.3.0 今天,我已经像往常一样打开Xcode的第一个项目,试图在iPhone上编译和debugging,我有时得到一个EXC_BAD_ACCESS (code=1…)崩溃的应用程序,有时得到EXC_BAD_ACCESS (code=EXC_ARM_DA_ALING…) ,在这里没有堆栈跟踪,但总是在main.m上: return UIApplicationMain(argc, argv, nil, NSStringFromClass([TGPAppDelegate class])); 看到第一个线程我发现,这是错误是有关谷歌地图: 试过以下几点: 更新吊舱(没有工作) 用gmaps sdk页面上的示例代码replace我的代码(没有工作)* 我已经看了一些关于汽车布局,禁用(没有工作) 奇怪的是我也是: 在一个iPhone 6与8.4(DID工作) 尝试在一个iPhone的8.3(DID工作) 这两个项目都处于testing阶段,所以我不这样做,如果真的有这个问题,但是我担心有些用户不能使用这个应用程序。 我无法通过互联网find太多的信息,我甚至不知道去哪里寻找,有没有关于这方面的任何已知的错误报告? 这里是我使用的示例代码: -(void)viewDidLoad { [super viewDidLoad]; GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:37.80948 longitude:5.965699 zoom:2]; GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera]; self.view = mapView; } 编辑1: 做更多的testing,发现问题只出现在debugging时(在运行应用程序时附加debugging器),如果从iPhone运行应用程序,然后将debugging器附加到进程,一切运行正常,我的意思是,如果地图试图渲染时,debugging器是附加的,那么你会得到exc_bad_access,这是一个debugging器错误呢?,我很困惑 […]

Google Maps API:获取当前位置iOS的坐标

我目前正在使用我的项目中的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_ […]

我如何在谷歌地图iosanimationGMSPolyline

我正在使用谷歌地图SDK,我必须在用户移动时绘制多段线,目前它只是animation标记,在引脚移动到特定位置之前绘制path。 我必须同时绘制path和移动引脚。 查看此video: https : //www.dropbox.com/s/q5kdjf4iq0337vg/Map_Sample.mov?dl = 0 这是我的代码 func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let location = locations.last! userPath.addCoordinate(location.coordinate) //userPath -> GMSMutablePath let polyline = GMSPolyline(path: userPath) polyline.strokeColor = UIColor(red: 0, green: 191/255.0, blue: 1, alpha: 0.8) polyline.strokeWidth = 5 CATransaction.begin() CATransaction.setAnimationDuration(2.0) self.userMarker.position = location.coordinate self.userMarker.rotation = location.course polyline.map = self.googleMapView CATransaction.commit() } […]

如何在iOS中的Google地图上添加button?

我是iOS编程的新手,我已经下载了iOS的谷歌地图sdk,并按照他们网站上的说明(如链接https://developers.google.com/maps/documentation/ios/start )所示,在我的应用程序中获取地图。 现在我正试图在谷歌地图底部的屏幕上添加一个button,让用户可以select返回到前一个屏幕。 我只知道UIButton是UIView的一个子类,我们可以通过使它成为该类的子视图来使button出现在视图上。 以前iOS默认使用Google Map来使用Google Maps,而且我在互联网上的书籍和书籍上看到了一些例子,在屏幕上显示了应用程序的屏幕快照,其中button或文本框会出现在地图上。 但是现在只需拖动界面生成器中的button并不能帮助Google地图的SDK。 这是我的代码: ViewController.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import <GoogleMaps/GoogleMaps.h> @interface ViewController : UIViewController @property (weak, nonatomic) IBOutlet UIButton *btn; @end ViewController.m #import "ViewController.h" #import <MapKit/MapKit.h> #import <GoogleMaps/GoogleMaps.h> #import <CoreLocation/CoreLocation.h> @interface ViewController () @end @implementation ViewController { GMSMapView *mapView_; } – (void)viewDidLoad { [super viewDidLoad]; // Do any additional […]

控制Google Maps for iOS中的animation持续时间

Google Maps for iOS的文档指出: 调用几种方法之一,可以让相机移动到新的位置。 您可以使用CoreAnimation控制animation的持续时间。 对于我的生活,我无法弄清楚如何控制animation的持续时间。 我曾尝试使用UIViewanimation,如: [UIView animateWithDuration: 5 animations:^{ GMSCameraPosition *camera = [self newCamera]; self.mapView.camera = camera; } completion:^(BOOL finished) { }]; 我已经看了CoreAnimation中的CALayeranimation。 但是,我不知道如何将图层animation应用到地图视图。 有人能指点我吗?

减小谷歌地图sdk为iOS的大小

我下载谷歌地图sdk(1.8.1)的ios,我用它在我的app.But我注意到的是框架的大小是55MB左右。有没有什么办法来减less框架的大小。 目录结构“GoogleMaps.framework / Versions / A”中名为“A”的文件大小约为54MB。谷歌地图依赖于这个文件,请给予一些帮助。

例外情况:在使用之前,Google Maps SDK for iOS必须通过进行初始化

我正在尝试使用Swift 2.0将Google Maps SDK实现到我的项目中。 我遵循这个,但是当运行这个,我的应用程序正在收到以下错误: 2015-08-25 19:05:17.337 googleMap[1919:54102] *** Terminating app due to uncaught exception 'GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:…] prior to use *** First throw call stack: ( 0 CoreFoundation 0x00000001058499b5 __exceptionPreprocess + 165 … … … 31 UIKit 0x000000010606699e UIApplicationMain + 171 32 googleMap 0x00000001034b720d […]

当我在Google Maps SDK for iOS中点击另一个标记时,是否可以拦截标记?

我知道我可以使用didTapAtCoordinate ,当我点击地图上的其他地方时,将会取消select标记。 但是,如果有多个标记,我点击另一个(例如MarkerA – > MarkerB),当前面的标记DidDeselect时是否有任何callback? 我在GMSMapView看了一下,却找不到任何可以使用的东西。 我想在select标记颜色或图像时更改标记颜色或图像,并在另一个标记select或标记取消select时将其更改。 谢谢。

在Google地图上加载标记的自定义信息窗口时,iOS应用会冻结

我正在尝试在iOS应用的Google地图标记上实现自定义信息窗口。 (就像这里和这里所做的那样) 我为它创build了一个xib和一个UIView类。 它被称为CustomInfoWindow.xib ,类是CustomInfoWindow.swift 。 我的自定义信息窗口目前是空白的,即我还没有添加任何UIControl到我的xib。 我还没有添加任何代码到我的类文件。 CustomInfoWindow.swift文件基本如下所示: import UIKit class CustomInfoWindow: UIView {} 在我的ViewController中,我的markerInfoWindow方法如下: func mapView(mapView: GMSMapView!, markerInfoWindow marker: GMSMarker!) -> UIView! { let customInfoWindow = NSBundle.mainBundle().loadNibNamed("CustomInfoWindow", owner: self, options: nil)[0] as! CustomInfoWindow return customInfoWindow } 当我运行代码,并点击我的标记之一,空白CustomInfoWindow显示正常。 奇怪的是,当我添加任何UI元素到界面生成器中的CustomInfoWindow.xib并再次运行我的应用程序,然后突然当我点击一个标记的应用程序冻结。 (例如,当我添加一个UILabel或UIImage到CustomInfoWindow.xib 。)如果我删除UI元素,那么空白的笔尖显示在标记的罚款。 如果我通过添加它作为子视图在一些视图控制器上testing我的笔尖,然后加载我的UILabel和UIImage罚款。 但是,当我在markerInfoWindow使用相同的笔尖时,应用程序会冻结。 问题是什么? 更新:这个问题发生在版本1.13的谷歌地图SDK的iOS版本,它原来是该版本的错误 。