Thursday, April 25, 2019

ios9 - iphone: didUpdateLocations not invoked when testing with the simulator




When debugging my app with the simulator, the routine didUpdateLocations is never involved. What I do:



In the simulator, I select Debug>location>Custom Location and the window with longitude and latitude pops up. When pressing ok, I would expect the didUpdateLocations to be called.



I use locMgr as a global variable in a ViewController-module:



locMgr = CLLocationManager()



and in the viewDidLoad-function includes the following sequence:



    locMgr.delegate = self
if CLLocationManager.authorizationStatus() == .NotDetermined {
locMgr.requestWhenInUseAuthorization()
}


I have coded the didUpdateLocations-function as a method of my viewcontroller class. I also verified (debugger), that the requestWhenInUseAuthorization-routine is invoked during initialisation. So were is the problem, why is the didUpdateLocations protocol-routine not invoked?


Answer




dasdom solved the problem by suggesting: Why requestWhenInUseAuthorization doesn't prompt the user for access to the location?


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...