开发者

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

开发者 https://www.devze.com 2023-04-05 11:02 出处:网络
My iPhone application us开发者_JAVA技巧es 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 disapp

My iPhone application us开发者_JAVA技巧es 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?


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.


It sounds like the OS asking you to approve use of location services for the app. I am not aware of any outstanding issues that would prevent that from closing and reopening the way you describe. As far as I know, you don't have any control over this, it will apprear automatically when your app triggers a location based method (e.g. -startUpdatingLocation or -startMonitoringForRegion).

It is possible you have another conflicting view that is trying to steal the view from the OS alert, but without any code, would be hard to say. Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号