【问题标题】:What to use instead of regionMonitoringAvailable which is deprecated in iOS 7?使用什么来代替 iOS 7 中已弃用的 regionMonitoringAvailable?
【发布时间】:2014-01-19 23:18:09
【问题描述】:

regionMonitoringAvailable 在 iOS 7 中已弃用。我们应该改用什么?

【问题讨论】:

标签: ios ios7 deprecated clregion


【解决方案1】:

CLLocationManager 的头文件指出您现在应该使用[CLLocationManager isMonitoringAvailableForClass:]

确定设备是否支持对指定区域类型的监控。如果NO,则所有监控指定区域类型的尝试都将失败。

您传入了您希望监控的CLRegion 类。例如:

[CLLocationManager isMonitoringAvailableForClass:[CLBeaconRegion class]];

编辑:正如@a​​nna 上面提到的,这也在Location and Maps Programming Guide 中进行了讨论。

Apple 通常会发布有关已弃用方法的替代方法的信息,但不幸的是,文档、标题和其他编程指南有时彼此不同步。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-10
    • 2016-08-10
    • 1970-01-01
    • 2013-09-25
    • 2013-09-24
    相关资源
    最近更新 更多