How To Get Current Latitude And Longitude In iPhone

How to get Current Latitude and Longitude in iPhone

In this application we will see how to get Current latitude and longitude using GPRS in the iPhone. So let see how it will worked. My last post you can get from here (attached the previous post link).

Step 1: Open the Xcode, Create a new project using View Base application. Give the application “Current_LatLong”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: Expand classes and notice Interface Builder created the ViewController class for you. Expand Resources and notice the template generated a separate nib,.xib for the Current_LatLong application.

Step 4: We need to add CoreLocation.framework in the project.

Step 5: Open the Current_LatLongViewController.h file and make the following changes:




Step 6: Double click the Current_LatLongViewController.xib file and open it to the Interface Builder. First drag the Round Rect Button from the library and place it to the view window. Now select the Round Rect button and bring up Connection Inspector and connect Touch Up inside to the File’s Owner icon and select Button: method. Now save the .xib file close it and go back to the Xcode.

Step 7: Open the Current_LatLongViewController.m file and make the following changes:




Step 8: Now compile and run the application on the actual device.

Comments 3

  1. The Controller is used as a delegate, but the h file does not declare the required delegate in code.
    Should be :
    @interface Current_LatLongViewController : UIViewController

Leave a Reply

Your email address will not be published. Required fields are marked *