iPhone SDK: Do I need to ask user for permissions to use GPS?
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 o开发者_开发知识库n 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.
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).
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...
精彩评论