Create a new project, single view application, objective-c, i Phone. In the View Controller.h file, import the frameworks that were added to the project and add the CLLocation Manager Delegate protocol.To see what’s going on with the authorization status, add a label, text field, and a button to the View Controller in Storyboard.
k CLAuthorization Status Authorized Always User authorized background use.
k CLAuthorization Status Authorized When In Use User authorized use only while app is in foreground.
We will monitor these and send a string to the text field depending on the status.
Then we call the type of authorization we want the user to approve. What’s important here is that once the type of authorization is set by the user, the only way to change it is to go to the “Settings” app of the i Phone.
If the user does not allow location services, you must later explicitly check for this and then direct the user to the “Settings” app to change it.