我想在谷歌地图中关闭我的视图后关闭GPS。但是箭头并没有消失!
这是我视图中的代码,名为BlockMapView:
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:g_lat
longitude:g_lng
zoom:15];
self.mapView = [GMSMapView mapWithFrame:self.bounds camera:camera];
self.mapView.delegate = self;
self.mapView.trafficEnabled = YES;
self.mapView.myLocationEnabled = YES;
self.mapView.settings.myLocationButton = YES;
self.mapView.settings.compassButton = YES;
[self addSubview:self.mapView];
在BlockMapView的ViewController中,我想用以下方法关闭GPS:
- (void)viewWillDisappear:(BOOL)animated{
self.blockMapView.mapView.myLocationEnabled = NO;
但GPS还在运行,我等了20分钟......
答案 0 :(得分:0)
仅仅因为菜单栏中仍然存在箭头并不意味着GPS无线电已上电。 Apple甚至在iOS的“设置”应用的“隐私/位置服务”部分中说明了这一点:箭头的存在意味着应用“最近使用了您的位置。”
在运行应用程序时使用仪器中的Energy Diagnostics模板确认GPS无线电是否仍然通电。