Tag: 谷歌地图

我的项目只在模拟器中运行,但不能在设备上工作,为什么?

我在地图上创build了一条折线。 并在地图视图中成功创build折线。 我的问题是,这个代码只运行模拟器。 不要在设备上工作。 我尝试了很多次,但没有在设备上工作。 Genrate的IPA和安装在我的设备,并崩溃我的应用程序。 为什么? 只需在模拟器中运行,为什么? 我遵循这个链接 为什么这是开心? 请帮助Thankyou 我的代码 -(void) centerMapForCoordinateArray:(CLLocationCoordinate2D *)routes andCount:(int)count{ MKCoordinateRegion region; CLLocationDegrees maxLat = -90; CLLocationDegrees maxLon = -180; CLLocationDegrees minLat = 90; CLLocationDegrees minLon = 180; for(int idx = 0; idx <count; idx++) { CLLocationCoordinate2D currentLocation = routes[idx]; if(currentLocation.latitude > maxLat) maxLat = currentLocation.latitude; if(currentLocation.latitude < minLat) […]

框架添加到cocoapod getiing导入问题“框架未find”

这是我的podfile: `target 'ROC' do source 'https://github.com/CocoaPods/Specs.git' platform :ios, '7.0' pod 'AFNetworking', '~> 2.5' pod 'INTULocationManager' pod 'Fabric' pod 'Crashlytics' pod 'FSMediaPicker' pod 'IQDropDownTextField' pod 'Google/Analytics' pod 'Google/SignIn' pod 'Appboy-iOS-SDK', '~>2.22' end ` 现在我打开podfile并添加pod“GoogleMaps” pod“GooglePlaces”,然后更新pod。 我可以在项目nevigator看到googleMaps框架,但不能导入,因为错误谷歌没有find与APPboy.same。 请做什么帮助。

Google地图SDK for Xcode上的当前位置更新无效

我一直在试图在我的应用程序中实现谷歌地图。 我想要做的第一步是简单得到是:1.获取应用程序要求许可使用当前位置2.find用户当前的位置,并有一个蓝点标记来标记它。 3.更新并居中围绕用户当前位置的地图。 我已经尝试了各种方法来得到这个工作,但总是以一个错误或不工作。 最初,当我模拟下面的代码,它确实想出了请求当前位置权限和蓝点的对话框,但在下面的模拟中,这似乎已经消失了,当改变我在模拟器中的当前位置(通过编辑scheme和改变默认位置),新的当前位置没有更新。 我有一种感觉,代码不能超越viewDidLoad。 我哪里错了? 请给我一些关于如何纠正这些问题的build议,并获得以上几点工作(以及模拟器总是要求获得当前位置的许可)。 目前代码运行没有错误,但只显示了我的英国地图。 (我已经添加NSLocationWhenInUse和NSLocationAlwaysUsage ….到info.plist。我已经禁用了所有的断点,我也试过重置模拟器) import UIKit import GoogleMaps class FirstViewController: UIViewController,CLLocationManagerDelegate { @IBOutlet weak var googlemaps: GMSMapView! //this is the connection from the storyboard to the view controller override func viewDidLoad() { super.viewDidLoad() let camera = GMSCameraPosition.camera(withLatitude: 51.508742, longitude: -0.087891, zoom: 8.0) let viewMap = GMSMapView.map(withFrame: CGRect.zero, camera: […]

Google地图中心缩放

我在我的iOS应用程序中使用谷歌地图,我已经修复了标记在视图的中心,以获得中心的位置。 现在,在缩放标记的同时,其他位置还在当前的位置。我想要实现的是在放大或缩小位置时应位于地图的中心查看我该如何实现。 任何帮助将是伟大的。 提前致谢..

如何在InfoWindow中包含一个button

我跟随本教程如何添加自定义信息窗口谷歌地图标记,在UIView我已经添加了一个button,并创build了一个IBAction,但是当我点击它没有发生 我的infoWindow视图代码看起来像这样 。H #import <UIKit/UIKit.h> #import "Details.h" @interface MarkerInfoWindowView : UIView @property (weak, nonatomic) IBOutlet UIImageView *imageView; @property (weak, nonatomic) IBOutlet UILabel *label1; @property (weak, nonatomic) IBOutlet UILabel *label2; @property (weak, nonatomic) IBOutlet UIButton *btn1; – (void) initializeWithDetails:(Details*)p_details; @end .M #import "MarkerInfoWindowView.h" @implementation MarkerInfoWindowView – (void) initializeWithDetails:(Details*)p_details { if(self != nil) { self.imageView.image = [UIImage […]

如何findGoogle Maps Path的长度

我正在使用适用于iOS的Google Maps SDK,并使用GMSMutablePath对象创build了一个路由。 在API文档中 ,它说它有一个名为lengthOfKind的函数来计算path的长度,但是它需要一个GMSLengthKindtypes的对象。 (CLLocationDistance) lengthOfKind: (GMSLengthKind) kind Returns the length of the path, according to kind. See GMSLengthKind. 然而,在文档中没有提到GMSLengthKind ,我似乎无法find任何对input有意义的东西。 有谁知道inout应该是什么,或者如果有另一种方法来计算path的长度? 这是我咨询的链接

长按Google地图

帮我解决问题。 我试图在Google地图上长时间跟踪地图,但是我无法做到这一点。 这是我的代码的一个例子: import UIKit import GoogleMaps class ViewController: UIViewController { @IBOutlet var mMap: GMSMapView! var longPressRecognizer = UILongPressGestureRecognizer() @IBAction func longPress(_ sender: UILongPressGestureRecognizer) { testTextview.text = "You tapped at YES" } override func viewDidLoad() { super.viewDidLoad() longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(self.longPress)) longPressRecognizer.minimumPressDuration = 0.5 mMap.addGestureRecognizer(longPressRecognizer) mMap.isMyLocationEnabled = true mMap.settings.compassButton = true mMap.camera = […]

GMSMapView清除方法不是去除GMSPolygon iOS吗?

我使用下面的代码在谷歌地图中添加多边形 for(int i = 0; i < [[polygon valueForKey:@"coordinates"] count]; i++){ [self.path addCoordinate:CLLocationCoordinate2DMake([[[[polygon valueForKey:@"coordinates"] objectAtIndex:i] objectAtIndex:1] floatValue],[[[[polygon valueForKey:@"coordinates"] objectAtIndex:i] objectAtIndex:0] floatValue])]; } GMSPolygon *rectangle = [GMSPolygon polygonWithPath:self.path]; rectangle.fillColor = [UIColor colorWithRed:255.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.4]; rectangle.map = self.mapView; rectangle.strokeColor=[UIColor redColor]; [self.restrictedLocations addObject:rectangle]; CLLocation *userLocation = [[mymanager sharedManager] userLocation]; [self.mapView bringSubviewToFront:self.locationMarkerView]; GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:userLocation.coordinate.latitude longitude:userLocation.coordinate.longitude […]

使用Google Maps SDK for iOS时,内存和CPU使用率非常高

我正在创build一个应用程序,我必须在地图上显示注册用户。 我必须显示他们的个人资料图片。 可能有很多,可能是1000,2000或3000。 问题是,通过添加每个图像,其内存使用增加,应用程序变慢。 例如,我正在使用这段代码: UIImageView * imgView = imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"like_r.png"]]; for(int i=0;i<1000;i++) { GMSMarker *marker = [[GMSMarker alloc] init]; marker.position = CLLocationCoordinate2DMake(31.4514885, 74.2642593); marker.iconView = imgView; marker.map=_mapView; } 有没有一种很好的方式来显示地图上的所有用户?

限制Google AutoComplete API只显示附近的位置

对于位置查找Google自动完成的作品不错,但它将search结果返回到世界各地。 我想限制在1000米半径或城市的search结果。 我跟着这个谷歌链接来集成自动完成search。 只有在项目中使用下面的代码 -(void)autoComplete { GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init]; acController.delegate = self; [self presentViewController:acController animated:YES completion:nil]; } // Handle the user's selection. – (void)viewController:(GMSAutocompleteViewController *)viewController didAutocompleteWithPlace:(GMSPlace *)place { [self dismissViewControllerAnimated:YES completion:nil]; // Do something with the selected place. NSLog(@"Place name %@", place.name); NSLog(@"Place address %@", place.formattedAddress); NSLog(@"Place attributions %@", place.attributions.string); } – […]