Location is enabled but asking to allow location

Discussion in 'iOS Programming' started by dado1, Nov 15, 2016.

  1. dado1 macrumors member

    Joined:
    Sep 12, 2009
    #1
    I'm programming in Swift, iOS 9/10, iPhone 5C+.

    App is geolocation based so user must have location enabled so send any request to server. There are 2 situations I can't solve:

    a) Even when I enable location at the very start it often happens to not being able to send request to server because error is: Location is not enabled or Allow your location.

    b) App has a map and when I open the map it finds my location (sometimes not, it throws the same error: allow your location) and when I leave my app opened for a few seconds without touching it the location dot goes gray, like location turns off
    [​IMG]

    This is code I'm using to check the status:

    Code:
    if CLLocationManager.authorizationStatus() == .AuthorizedWhenInUse {...}
     
  2. grandM macrumors 6502a

    grandM

    Joined:
    Oct 14, 2013
    #2
    Where did you declare your manager? Could it be the manager gets lost? It shouldn't be a local variable.
     

Share This Page