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

后端 未结 1 1569
执笔经年
执笔经年 2021-02-18 23:48

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

1条回答
  •  天命终不由人
    2021-02-19 00:29

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

    0 讨论(0)
提交回复
热议问题