Tag: currentlocation

当使用GoogleMaps时,myLocationEnabled在swift上更改为isMyLocationEnabled

我试图让用户目前的位置显示与谷歌地图API。 我一直在努力解决这个问题几个星期,代码运行,但没有更新到当前位置,当我在模拟器中更改位置。 我的代码是在下面,看看其他人在做什么,他们都有mapView.myLocationEnabled = true,而对于我这会产生一个错误,说'myLocationEnabled已被重命名为'isMylocationEnabled'。 我见过一些最新的post(从2个月前),每个人都使用myLocationEnabled似乎没有错误,为什么我得到这个? 这可能是我目前的位置没有更新的原因吗? import UIKit import GoogleMaps class FirstViewController: UIViewController, CLLocationManagerDelegate { @IBOutlet weak var mapView: GMSMapView! let locationManager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() locationManager.delegate = self mapView.settings.myLocationButton = true mapView.settings.compassButton = true } override func viewDidAppear(_ animated: Bool) { locationManager.requestWhenInUseAuthorization() } func locationManager(manager: CLLocationManager , didChangeAuthorizationStatus status: CLAuthorizationStatus) […]

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: […]

如何在build筑物地图中获得精确的当前位置

我有一张build筑物地图 ,上面有很多房间。 现在,我想放弃该build筑物地图中的用户所在的位置,如果用户想要导航到其他房间,也想绘制方向。 如果有人知道请引导我正确的方式。

为当前位置自定义Google地图蓝点

我正在使用2013版Google地图SDK for iOS。 我想用另一个图标或周围的脉冲圈来自定义当前位置的默认蓝点。 我知道我们可以使用 – mapView:viewForAnnotation:在MKMapView中,但我不知道如何使用Google地图。 谢谢你的帮助 :)

为当前位置注释设置canShowCallOut = NO

我为当前位置图标使用自定义调用(标题和副标题)。 我试图closures默认注释,但它不起作用。 – (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation { NSLog(@"viewForAnnotation"); if ([annotation isKindOfClass:[MKUserLocation class]]) { MKAnnotationView *userLocationView = [mapView viewForAnnotation:annotation]; userLocationView.canShowCallout = NO; NSLog(@"[annotation isKindOfClass:[MKUserLocation class]"); return nil; } } 唯一的办法是 -(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)ann { if([ann.annotation isKindOfClass:[MKUserLocation class]] ) { [mymap deselectAnnotation:ann.annotation animated:NO]; } } 但它有时滞后。 有没有其他的方法来禁用当前位置注释的默认标注视图? 任何帮助将不胜感激。

Google地图中的当前位置

我试图在Google地图上显示用户的当前位置,但在下面的情况下,地图甚至不显示。 我应该改变什么来解决这个问题? var locationManager = CLLocationManager() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. //user location stuff locationManager.delegate = self locationManager.requestWhenInUseAuthorization() locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.startUpdatingLocation() } func locationManager(manager: CLLocationManager, didFailWithError error: NSError) { print("Error" + error.description) } func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let userLocation = locations.last let […]

如何通过iphone应用程序中的代码获取用户的当前位置?

我想从我的iPhone应用程序获取用户的当前位置。 我想在我的应用程序中显示用户的当前位置,如国家名称,纬度,经度信息。 而且我也想显示在谷歌地图的位置。 我也试过谷歌search,但无法得到确切的答案。 我得到的信息是在我的应用程序中使用CLLocationManager来跟踪位置。 我如何使用这个? 我已经从苹果文档下载了一个示例应用程序。 这里是链接: https : //developer.apple.com/library/ios/#samplecode/LocateMe/Introduction/Intro.html 你能帮我吗? 提前致谢。