It drains the battery life of the device when it has to communicate with GPS satellites or power up the radio for location triangulation, so we want to turn it back off again as soon as we have a good-enough position. We next set our current class as delegate to receive CLLocation Manager Delegate messages.
Finally, we tell Core Location to start figuring out our position.
Developing i OS apps that can take advantage of the built-in GPS unit is a great way to add a new dimension to the user experience.
You can quickly make your apps location-aware with minimal effort.
In Xcode, click on the project’s name at the top of the project navigator view.
So, be sure to add the following to your class, and synthesize the same in the implementation: e don’t want to leave Core Location running for any longer than we absolutely need it to.
You can also use it to define geographic regions and monitor when the user crosses the boundaries of those regions.
These mechanisms include GPS, cell tower triangulation and (the least accurate) by using the IP address of available Wi-Fi connections.
This is a simple, single view project with an // Configure location manager location Manager.activity Type = CLActivity Type.
Other Navigation location Manager.desired Accuracy = k CLLocation Accuracy Best location Manager.delegate = self location Manager.start Updating Location() The location manager in the previous section tells us where we are in terms of longitude, latitude and speed, but to really visualize it we need a map.