How can I disable any CLRegion objects registered with -startMonitoringForRegion?

自作多情 提交于 2019-11-28 22:54:17
thepaperboy

Or, a more simple solution:

for (CLRegion *monitored in [locationManager monitoredRegions])
    [locationManager stopMonitoringForRegion:monitored];

Ok, I think I can answer my own question here finally. Does this mean I can claim my own bounty? :D

First off, the lingering location arrow seems to be an iOS bug. I have found multiple stories out there with the very same issue. So there won't be much I can do about that for now.

As far as removing all of my regions at once, I got this down pat now.

NSArray *regionArray = [[locationManager monitoredRegions] allObjects]; // the all objects is the key
for (int i = 0; i < [regionArray count]; i++) { // loop through array of regions turning them off
     [locationManager stopMonitoringForRegion:[regionArray objectAtIndex:i]];
}

I was able to display my array and proved they were all in there. Another check after removing shows they are all gone. Whew!! The issue of the location arrow remains depending on which version of iOS you are running. I can't that I guess. If you have users, make sure you inform them the purple arrow is not your fault. For more info on the issue, you can start here. GetSatisfaction Good luck.

Yes it is an iOS bug. Deleting and reinstalling the app does not help. The only way I managed to get rid of the problem is by resetting location warnings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!