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

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

Вопрос

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

Это было полезно?

Решение

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];
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top