CLLocationManager startUpdatingLocation not calling locationManager:didUpdateLocations: or locationManager:didFailWithError:

前端 未结 8 1751
囚心锁ツ
囚心锁ツ 2020-12-05 06:21

I\'m trying to use the CLLocationManager framework in my iOS project to access the user\'s location but when I call

[locationManager startUpdat         


        
8条回答
  •  执念已碎
    2020-12-05 07:01

    enter image description hereJust add this in info.plist

    NSLocationAlwaysUsageDescription --- I need Location

    NSLocationWhenInUseUsageDescription --- I need Location

    privacy - location usage description --- I need Location

      locationManager = [[CLLocationManager alloc] init];
      locationManager.delegate=self;
      locationManager.desiredAccuracy=kCLLocationAccuracyBest;
      locationManager.distanceFilter=kCLDistanceFilterNone;
      [locationManager requestWhenInUseAuthorization];
      [locationManager startMonitoringSignificantLocationChanges];
      [locationManager startUpdatingLocation];
    

    Now it will call your didUpdateToLocation definitely.

    for more details click here

提交回复
热议问题