Since the depreciation of initCircularRegionWithCenter:radius:identifier:
, how would you define the region to be monitored using CLLocationManager
?
Asked
Active
Viewed 9,888 times
18
1 Answers
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
-
1I would stick with a radius between 1 and 400 meters unless Apple update their docs stating otherwise. – Oct 16 '13 at 11:53
-
6CLCircularRegion 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