18

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

elp
  • 8,021
  • 7
  • 61
  • 120
Luthelis
  • 264
  • 2
  • 9

1 Answers1

35

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];
  • Do you happen to know what is the max recommended radius for them? – Pochi Oct 10 '13 at 01:13
  • 1
    I would stick with a radius between 1 and 400 meters unless Apple update their docs stating otherwise. –  Oct 16 '13 at 11:53
  • 6
    CLCircularRegion inherits from CLRegion, so I don't think a cast is necessary. But other than that, I agree: you replace the deprecated method by creating the CLCircularRegion subclass with its initializer and using that in place of a CLRegion. – Mario Oct 26 '13 at 20:55