Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dialog asking if user wants to allow use of location services pops and disappears in iPhone

My iPhone application uses location services. When i first install and run it, it shows dialog asking if user wants to allow use of location services for a moment and immediately disappears. This happens few times in a row.

Is it a known bug or I'm doing something wrong?

like image 569
Misha Avatar asked Sep 16 '11 05:09

Misha


1 Answers

I had the same issue in my app just now, I'll add this as an answer for anyone who googles the question and comes across this old question.

The problem is that if you instanciate CLLocationManager locally and ask it to update its location, the window which asks for permission disappears instantly after it pops up.

You have to make CLLocationManager a property (or at least you should not instanciate it locally), then it works.

like image 80
Philipp Avatar answered Sep 20 '22 13:09

Philipp