Gps startMonitoringSignificantLocationChanges从不在iOS8上接收位置

Gps startMonitoringSignificantLocationChanges从不在iOS8上接收位置,gps,ios8,cllocationmanager,Gps,Ios8,Cllocationmanager,我在iOS 8中的startMonitoringSignificantLocationChanges中遇到问题 当使用以下代码时,我的iOS 8物理设备和模拟器决不点击didUpdateLocations方法: -(void)viewDidLoad { if (self.locationManager==nil) { self.locationManager = [[CLLocationManager alloc] init]; } self.locationM

我在
iOS 8中的
startMonitoringSignificantLocationChanges
中遇到问题

当使用以下代码时,我的iOS 8物理设备和模拟器决不点击
didUpdateLocations
方法:

 -(void)viewDidLoad {
        if (self.locationManager==nil) { self.locationManager = [[CLLocationManager alloc] init]; }
        self.locationManager.activityType = CLActivityTypeFitness;
        self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
        self.locationManager.delegate = self;
        if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
            NSLog(@“requestAlwaysAuthorization”);
            [self.locationManager requestAlwaysAuthorization];
        }
        [self.locationManager startMonitoringSignificantLocationChanges];

    }

    - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
        NSLog(“didUpdateLocation”);
    }
如果我将
startMonitoringSignificantLocationChanges
替换为
startUpdatingLocation
,则物理设备会收到一次更新(这不是我所期望的),但模拟器会继续收到不断的更新(这是我所期望的,但不是我想要的)


如果您有任何关于如何解决此问题的想法,我们将不胜感激。我还希望在使用授权时使用
requestwhenuseauthorization
,而不是
requestAlwaysAuthorization
,但我在其他地方读到,如果我想使用
startMonitoringSignificantLocationChanges
,我需要使用
requestAlwaysAuthorization

您必须在plist文件中为密钥NSLocationAlwaysUsageDescription定义一个描述字符串

<key>NSLocationAlwaysUsageDescription</key>
<string>With this mode, you will never miss location updates!</string>
NSLocationAlwaysUsageDescription
使用此模式,您将永远不会错过位置更新!

我有
nslocationwhenUsageDescription
但没有意识到有一个单独的
NSLocationAlwaysUsageDescription
键。非常感谢。