Current Location in iPhone and iPad

Introduction

In this article I will create a Single View application. Here I use map view from xib and write code to determine the current location of the device where. Using this app we determine our current location.

To understand it we use the following.

Step 1

Open XCode by double-clicking on it.

Select-xcode-in-iphone.jpg

Step 2

Create a New XCode Project via click on it.

create-project-in-iphone.jpg

Step 3

Now Select Single View Application and click on Next.

single-view-application-in-iphone.jpg

Step 4

Now provide your Product Name and Company Identifier.

project-name-in-iPhone-iPad.jpg

Step 5

Select the location where you want to save your project and click on Create.

save-project-location-in-iphone.jpg

Step 6 

Here first add the framework MkMapkit which is required to show location.

To import this framework we use the following.

Step 7

Click on project and select Build Phase.

build-phase-in-iPhone.jpg

Step 8

Click on the "+" icon to add a framework.

Step 9

Select framework which you want to add write on search bar and click on add button.

add-mapkit-framework-in-iPhone.jpg

Step 10

Now we write code and add mapview from xib.

Current-location-code-in-iPhone.jpg

linking-in-iPhone.jpg

Step 11

Click on the run button to show the output.

Step 12

Output show in the output Window of Xcode.

Output-in-Xcode-window-in-iPhone.jpg

The current location doesn't show in the iPhone Simulator to determine the current location's latitude and longitude values when we run this application in the device.

Up Next
    Ebook Download
    View all
    Learn
    View all