【问题标题】:How are the CLLocationmanger delegate methods arecalled when the application is in background mode?当应用程序处于后台模式时,如何调用 CLLocationmanger 委托方法?
【发布时间】:2012-01-11 03:30:11
【问题描述】:

当应用程序进入后台时,如何获取 CLLocationManager 委托方法,

我是CLLocationManager的新手

实际上,当应用程序在前台运行时,我的应用程序会调用 CLLocationmanager dalegate 方法,但当应用程序进入后台时,这些方法不会被调用。

通过使用

[locationManager startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyBest];

让我的应用程序调用这些方法

- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region  {
    NSLog(@"Entered Region");
}
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region  {
    NSLog(@"Exited Region");
}

如何在appDelegate 类中使用CLLocationmanagerdelegate

【问题讨论】:

    标签: iphone objective-c cocoa-touch ios4 core-location


    【解决方案1】:

    看看我的question 的答案,因为它们非常相关。

    基本上,创建一个单例 CLLocationManager 解决了这个问题。

    【讨论】:

      【解决方案2】:

      您是否在应用的 plist 中设置了背景模式以包含定位服务?

      【讨论】:

      • 是的,我也有同样的问题。并在 plist 中设置为“应用程序注册位置更新所需的背景模式”但没有解决..任何人都可以帮忙吗?....谢谢..
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      • 2017-11-06
      • 2018-02-14
      • 1970-01-01
      • 2017-11-20
      相关资源
      最近更新 更多