0

在 Google 地图中关闭视图后,我想关闭 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分钟......

4

1 回答 1

0

仅仅因为箭头仍然出现在菜单栏中并不意味着 GPS 无线电已通电。Apple 甚至在 iOS 设置应用程序的隐私/位置服务部分中声明了这一点:箭头的存在意味着应用程序“最近使用了您的位置”。

在运行应用程序时使用 Instruments 中的 Energy Diagnostics 模板来确认 GPS 无线电是否仍然通电。

于 2013-09-03T14:25:15.077 回答