views:

461

answers:

2

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  A: 

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).

Vladimir
Great answer, thanks.
RaYell
+2  A: 

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...

mihirpmehta
Is there a reason why it doesn't ask for that on the simulator?
RaYell
I don't know... may be as simulator resides in computer only... there is no functionality of fetching its location in simulator...as they might need service provider's help in it...
mihirpmehta