How do you use CLRegion in iOS 7 since initCircularRegionWithCenter:radius:identifier: is deprecated?

StackOverflow https://stackoverflow.com/questions/19205210

Question

Since the depreciation of initCircularRegionWithCenter:radius:identifier:, how would you define the region to be monitored using CLLocationManager?

Was it helpful?

Solution

Since CLCircularRegion is a subclass of CLRegion, you can just cast the instance.

CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:theCenter
                                                             radius:theRadius
                                                         identifier:theIdentifier];

// Then cast the instance for use with your CLLocationManager instance
[manager startMonitoringForRegion:(CLRegion *)region];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top