Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLLocationManager's pausesLocationUpdatesAutomatically property always false in Swift (iOS8 / iOS7)

I try to set the location manager's pausesLocationUpdatesAutomatically to true in Swift but it seems to have no result.

Also, according to the documentation:

The default value of this property is true.

However, the default value in reality seems to be false and also there seems to be no way of setting it to true:

let manager = CLLocationManager()
println(manager.pausesLocationUpdatesAutomatically) // prints false

manager.pausesLocationUpdatesAutomatically = true
println(manager.pausesLocationUpdatesAutomatically) // prints false

How to set this property to true?

like image 394
Aris Goudouras Avatar asked Nov 26 '25 06:11

Aris Goudouras


1 Answers

If you're running it in the simulator, it will always show "false".

Try running it on the device, like I just did, it will always say "true".

NOTE: This is applicable to iOS7-iOS11, and Objective-C as well.

like image 122
Michael Dautermann Avatar answered Nov 28 '25 20:11

Michael Dautermann