From the course: Advanced iOS App Development: MapKit & Core Location
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Code with location services - iOS Tutorial
From the course: Advanced iOS App Development: MapKit & Core Location
Code with location services
- [Instructor] With location services authorized, you're ready to get a device's location. Location's come from the CCLocation object, which we'll get from a delicate method. You, as a developer, have to tell location services to look for locations, then read the delegate, when the device has a location update. Head to the enable location services method we added earlier. Add an if statement here. We'll use the location services enable class method, to check if we have the right hardware, and if the user has location services turned on in the settings panel. If we do, I'll start updating locations with the start updating location method. So, if CLLocation Manager, location services enabled, location manager, start, updating location. I'll stop updating location at some point. Stop updating location in the disable location services, with the stop updating location method. So, that'll just be in here. Location manager, stop, updating location. When the user presses the here button on…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.