繁体   English   中英

位置状态栏图标不会消失-MKMapView-iOS 6.1

[英]Location Status Bar Icon Won't Disappear - MKMapView - iOS 6.1

我有一个包含MKMapView实例的类

@property(nonatomic, weak) IBOutlet MKMapView *ibMapView;

虽然我还在项目的其他位置使用了CLLocationManager的单例实例,但我发现此地图视图负责显示在iPhone状态栏上的“位置”图标。

具体来说,该代码应归咎于:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    // If I comment out this line below, the "Location" status icon never shows, as expected 
    self.ibMapView.showsUserLocation = YES;

    // ...other magical stuff happens here, not related to map view
}

我已经尝试将showsUserLocation设置为NO,就像这样

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.ibMapView.showsUserLocation = NO;

    // I also have tried logging to make sure showUserLocation is set to NO- returns "NO" as expected
    DebugLog(@"Show User Location: %@", self.ibMapView.showsUserLocation ? @"YES" : @"NO");

    // ...other stuff happens here, not related to map view...
}

但是,位置状态图标仍显示...即使经过一个小时,它也永远不会关闭...

如何将MKMapView实例上的showUserLocation设置为YES导致的位置状态图标消失?

事实证明,这是苹果框架中的一个错误……

查看此问题和选择的答案以获取解决方案:

在调用stopUpdatingLocation之后,位置指示器在状态栏上仍然存在,但仅适用于旧的捆绑包标识符

本质上,如果您重置位置和隐私 (设置->常规->重置->重置位置和隐私),则可以解决此问题(只要您还确保在完成操作showsUserLocation设置为NO,即可) 。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM