iOS 5 Region Monitoring: Can new regions be created based on users current coordinates from coreLocation?

陌路散爱 提交于 2019-12-06 13:13:42

Theoretically, You can monitor any region any time, these regions don't need to be predefined, you may use following code to create and monitor your required regions pragmatically,

CLLocationCoordinate2D center = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude);
CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:center radius:50.0f identifier:identifier];
[self.locationManager startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyBest];

PS: Region monitoring implementation is not as much useful as apple advertise, to my understanding it relies on cell change events (again to save the battery). I'm not happy even with the results of default Reminders app (location based reminders) both on iPhone 4 and 4s.

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