iPhone SDK: Do I need to ask user for permissions to use GPS?

独自空忆成欢 提交于 2020-01-13 09:56:05

问题


In my iPhone application I need to use GPS (CoreLocation to be exact) to get current position of the device. I know that most (if not all) applications using GPS have a popup implemented asking the user to allow GPS access. Is that done automatically by the iPhone SDK or should I implement such functionality myself?

I've tried to run my app on iPhone Simulator and it didn't ask for permissions at all so I'm wondering if the same thing will happen on the actual phone.

And if I implement that itself and the SKD provides that out-of-the-box then I'll have two confirmation in my app which I don't want.


回答1:


It won't be ask for permission in iphone simulator... It will ask for user permission in iphone device only... and for that you do not need to do anything explicitly.. It will ask implicitly...




回答2:


This popup is displayed automatically by system if you try to access core location services on device for the first time.
If user denies access then your location delegate will receive didFailWithError: message with kCLErrorDenied error and you must stop using location service then (e.g. call [manager stopUpdatingLocation]; on your location manager).



来源:https://stackoverflow.com/questions/2690255/iphone-sdk-do-i-need-to-ask-user-for-permissions-to-use-gps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!