When I install my app in iphone and run first time then it ask user permission for core location service. Here is the image for simulator.
In my app, my first view of application needs current location and based on location it lists some events. If application couldn't get location it shows the default list of events.
So, I would like to know that Is it possible to hold the application flow until user click on either " Don't allow
" or "ok
" button ?
I know if user clicks on "Don't allow" then kCLErrorDenied
error will get fired.
Currently what happens, if user does not click on any of buttons, application displays listing page with default list (without location). And after that if user clicks on "ok
" button then nothing happens !!! How can I refresh the page upon "ok
" button click ?
Thanks….
Yes, just don't do anything until those delegate methods are invoked. When they click 'OK', that's just a signal for Cocoa to go and then try to retrieve the user's location - you should structure your app so that when the CLLocationManager has a location or can't get one, your app then continues.
You wouldn't want to say, pause your app until the location returns/fails; that's not what object oriented development is about.
In your view logic wait until the CoreLocation delegates of didUpdateToLocation or didFailWithError are called. Have those methods call/init your list and UI data fill.
Sample Controller:
Header
Code