我有一个包含MKMapView实例的类
@property(nonatomic, weak) IBOutlet MKMapView *ibMapView;虽然我在项目的其他地方也使用了CLLocationManager的单例实例,但我发现这个地图视图负责在iPhone状态栏上显示"Location“图标。
具体而言,应归咎于以下代码:
- (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设置为不像这样
- (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导致的位置状态图标消失?
发布于 2013-02-26 07:39:21
事实证明,这是苹果框架中的一个漏洞.
有关解决方案,请参阅此问题和选定的答案:
本质上,如果您Reset Location & Privacy (Settings -> General -> Reset -> Reset Location & Privacy),这就解决了这个问题(只要您还确保完成后showsUserLocation设置为NO )。
https://stackoverflow.com/questions/15082969
复制相似问题