Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dado1

macrumors member
Original poster
Sep 12, 2009
31
0
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
jdI1E.jpg


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

Code:
if CLLocationManager.authorizationStatus() == .AuthorizedWhenInUse {...}
 
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
jdI1E.jpg


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

Code:
if CLLocationManager.authorizationStatus() == .AuthorizedWhenInUse {...}
Where did you declare your manager? Could it be the manager gets lost? It shouldn't be a local variable.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.