2011-12-02 66 views
0

我怎样才能获得CLLocationManager委托方法,当应用程序已经进入后台,当应用程序处于后台模式时,如何调用CLLocationmanger委托方法?

我是新来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"); 
} 

如何使用在appDelegateCLLocationmanagerdelegate

回答

0

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

+0

是的,我也有同样的问题。我在plist中设置为“所需的背景模式到应用程序注册的位置更新”,但没有解决..可以帮助任何人?....谢谢.. –

0

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

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

相关问题