region Monitoring on iOS
I was just wondering what devices support region m开发者_运维技巧onitoring? I know iPhone 4 does, but does iPad 2 support this?
Also the documentation suggests:
For this reason, Core Location limits the number of regions that may be simultaneously monitored by a single application.
What is the region limit that can be monitored using this feature?
I would guess that non-3G devices don't currently support region monitoring: my testing indicates that it's exclusively based on cell-tower handoffs, so the other location services (Wi-Fi and GPS) can't provide that functionality. It's probably best not to base your code on assumptions about specific hardware: CLLocationManager has a maximumRegionMonitoringDistance
property which will return -1
on devices that don't support region monitoring.
The iPad2 uses the same location framework as the iPhone and iPad 1. It should work.
I'm not sure what the limit is.
I've noticed an iPad2(without sim) and iPod not add regions successfully. Use this code to guard your monitoring code from being ran for devices which do not support region monitoring in iOS8 SDK:
if ([UIDevice currentDevice].systemVersion.integerValue >= 7 &&
![CLLocationManager isMonitoringAvailableForClass:CLRegion.class]) {
return;
}else if(![CLLocationManager regionMonitoringAvailable])
return;
精彩评论