# Deferring Location Updates not working

**URL:** <https://forums.kodeco.com/t/deferring-location-updates-not-working/38794>\
**Category:** Swift\
**Created:** [January 22, 2018, 7:45pm UTC](https://forums.kodeco.com/t/deferring-location-updates-not-working/38794 "2018-01-22T19:45:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anand4u](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@anand4u](https://forums.kodeco.com/u/anand4u)\
**Post date:** [January 22, 2018, 7:45pm UTC](https://forums.kodeco.com/t/deferring-location-updates-not-working/38794/1 "2018-01-22T19:45:55Z")

</div>

Do any of you guys experience the same issue that i’ve been experiencing. Here is my code:

let locationManager : CLLocationManager = CLLocationManager()  
locationManager.delegate = self  
locationManager.desiredAccuracy = kCLLocationAccuracyBest  
locationManager.allowsBackgroundLocationUpdates = true  
locationManager.activityType = CLActivityType.fitness  
locationManager.distanceFilter = kCLDistanceFilterNone;  
locationManager.pausesLocationUpdatesAutomatically = false;

```
            locationManager.requestAlwaysAuthorization();
            locationManager.startUpdatingLocation()

```

and in my didUpdateLocations delegate i have this code:

if (CLLocationManager.deferredLocationUpdatesAvailable()) {  
let timeInterval: TimeInterval = TimeInterval(60  
locationManager.allowDeferredLocationUpdates(untilTraveled: CLLocationDistanceMax, timeout: timeInterval)  
}

And this CLLocationManager.deferredLocationUpdatesAvailable() always returns false. I have an iPhone 6plus running iOS 11.0.3.

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [January 23, 2018, 2:33am UTC](https://forums.kodeco.com/t/deferring-location-updates-not-working/38794/2 "2018-01-23T02:33:16Z")

</div>

Hi @anand4u, what error are you getting from the debug console?

---

<div class="post-metadata">

**Author:** ![anand4u](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@anand4u](https://forums.kodeco.com/u/anand4u)\
**Post date:** [January 23, 2018, 9:34pm UTC](https://forums.kodeco.com/t/deferring-location-updates-not-working/38794/3 "2018-01-23T21:34:09Z")

</div>

Hello @gdelarosa. Sorry for this late reply. This is the error that i am getting:

“The operation couldn’t be completed. (kCLErrorDomain error 11.)”

---

<div class="post-metadata">

**Author:** ![gdelarosa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gdelarosa/32/109063_2.png) [@gdelarosa](https://forums.kodeco.com/u/gdelarosa)\
**Post date:** [January 24, 2018, 3:05am UTC](https://forums.kodeco.com/t/deferring-location-updates-not-working/38794/4 "2018-01-24T03:05:12Z")

</div>

Hi @anand4u, thanks for providing the error, but I am unable to tell you why your issue is occurring based off that error message. Could you post a screenshot of the message on your debug console? I would also try to clean the project, deleting then re-downloading the app on the simulator, and restarting xcode. Sometimes those can be quick and easy fixes.

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [July 8, 2018, 11:57am UTC](https://forums.kodeco.com/t/deferring-location-updates-not-working/38794/5 "2018-07-08T11:57:56Z")

</div>

Closed on July 8, 2018, 11:57am UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
