0

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?

Robert Brusa
  • 322
  • 1
  • 2
  • 11
  • I find, that even after the call to requestWhenInUseAuthorization() the status is unchanged and is still .NotDetermined – Robert Brusa Nov 21 '15 at 14:46
  • Have you added the two keys to you Info.plist as described [here](http://stackoverflow.com/a/31845567/498796)? – dasdom Nov 22 '15 at 06:54
  • Instead of running my app in the simulator, I downloaded it to my iPhone. Same behaviour. didUpdateLocations is not invoked. – Robert Brusa Nov 23 '15 at 13:37
  • Yes - it was the Info.plist file entry that was missing. Thank you dasdom and shame on Apple. The fact that this entry is required in Info.plist is dammed well hidden.... – Robert Brusa Nov 24 '15 at 11:16
  • Unfortunately I can't post it as an answer because it is to trivial. – dasdom Nov 24 '15 at 11:19

1 Answers1

0

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

Community
  • 1
  • 1
Robert Brusa
  • 322
  • 1
  • 2
  • 11