iOS Location Handling - IOS

What is iOS - Location Handling?

We can locate where the user is with the help of IOS, but the user should allow the application to access the information with core location framework.

Location Handling – Steps Involved

Step 1. Create a simple View based application.

Step 2. Select your project file, then select targets and then add CoreLocation.framework as shown below −

iOS  Location Handling

Step 3. Add two labels in ViewController.xib and create ibOutlets naming the labels as latitudeLabel and longitudeLabel respectively.

Step 4. Create a new file by selecting File-> New -> File... -> select Objective C class and click next.

Step 5. Name the class as LocationHandler with "sub class of" as NSObject.

Step 6. Select create.

Step 7.We need to update LocationHandler.h as follows −

Step 9. Update ViewController.h as below, where we need to implement the LocationHandler delegate and create two ibOutlets

Step 10. Update ViewController.m as follows −


On executing the application, we'll get the below result as output −

iOS  Location Handling

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

IOS Topics