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

Luthelis picture Luthelis · Oct 6, 2013 · Viewed 9.7k times · Source

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

Answer

Mic Pringle picture Mic Pringle · Oct 8, 2013

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];