iOS 7终止后重大位置更改发布 [英] iOS 7 Significant location change launch after termination

查看:117
本文介绍了iOS 7终止后重大位置更改发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用会在新的位置数据到达iOS 6后终止后自动唤醒,但不会在iOS 7上唤醒。

My app automatically wakes up after termination when new location data arrives on iOS 6, but not on iOS 7.

[[UIApplication sharedApplication ] setBackgroundRefreshStatus] UIBackgroundRefreshStatusAvailable

信息中。 plist 我设置 UIBackgroundModes ,其值为location。

In Info.plist I set UIBackgroundModes with value "location".

CLLocationManager 以这种方式启动:

- (void) start {
  if (locationManaher == nil) {
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate        = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
  }

  [locationManager startMonitoringSignificantLocationChanges]
}

- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {

  CLLocationCoordinate2D newCoordinate = newLocation.coordinate;
  CLLocationCoordinate2D oldCoordinate = oldLocation.coordinate;

  if (newCoordinate.latitude == oldCoordinate.latitude && newCoordinate.longitude == oldCoordinate.longitude) return;

  float distance = [newLocation distanceFromLocation:oldLocation];

  if (distance < distanceFilter) {
    //send to server 
  }
}

有人知道问题出在哪里吗?

Does anybody know where is a problem?

推荐答案

它是7.0 iOS功能,如果用户手动关闭应用程序(从主页按钮双击),应用程序不会触发位置更改。

It is 7.0 iOS feature, if user closes the app manually (from home button double click), the application doesn't triggers on location change.

这篇关于iOS 7终止后重大位置更改发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆