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

时间:2013-02-26 06:43:13

标签: iphone ios objective-c core-location

我有一个包含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...
}

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

如何通过showUserLocation个实例上的MKMapView设置为YES来获取位置状态图标?

1 个答案:

答案 0 :(得分:0)

事实证明,这是Apple框架中的一个错误...

请参阅此问题以及解决方案的所选答案:

Location indicator persists on status bar after stopUpdatingLocation is called, but only for old Bundle Identifier

基本上,如果您重置位置&隐私(设置 - >常规 - >重置 - >重置位置和隐私权限),这样可以解决问题(只要您确保将“{1}}设置为否定”用它完成它。