Using iPhone SDK MapKit Framework – A tutorial

June 22, 2009 at 8:15 pm 111 comments

Recently I was working on an application in which the map was required to be shown with in the application itself. I tried looking for some online resources that could be of some help but did not find any. I was not able to find any good tutorial that explains how can an address be shown on a map with the application. Therefore, I decided to write one and here it is. Hope it will be of some help.

Lets create a simple application which displays the address entered by the user on the map within the application. We’ll call it MapApp.

  1. First, create a Window based application and name the project as MapApp.
  2. Add the MapKit framework to the project. (Control + Click Frameworks folder -> Add -> Existing Frameworks)
  3. Create a new view controller class and call it MapViewController. Add a text field, button and map view to it.
    #import <UIKit/UIKit.h>
    #import <MapKit/MapKit.h>

    @interface MapViewController : UIViewController<MKMapViewDelegate> {
        IBOutlet UITextField *addressField;
        IBOutlet UIButton *goButton;
        IBOutlet MKMapView *mapView;


4. Now create a xib file named MapView.xib. Set its type to MapViewController and add a UITextField, UIButton and MKMapView to it. This how it will look like.


Make sure you set the delegate for the mapView to the controller class.

5. Once the view is ready, update the MapAppDelegate so that the view controller and the view is loaded.

    - (void)applicationDidFinishLaunching:(UIApplication *)application {
        mapViewController = [[MapViewController alloc] initWithNibName:@"MapView" bundle:nil];
        [window addSubview:mapViewController.view];
        [window makeKeyAndVisible];

6. Now, build the app and check if the view appears correctly or not. We now have the UI ready for entering the address and button for updating the location in the map.

7. Add the class for showing the annotation on the location. Lets call this class as AddressAnnotation.

    @interface AddressAnnotation : NSObject<MKAnnotation> {
        CLLocationCoordinate2D coordinate;
        NSString *mTitle;
        NSString *mSubTitle;

    @implementation AddressAnnotation

    @synthesize coordinate;

    - (NSString *)subtitle{
        return @"Sub Title";

    - (NSString *)title{
        return @"Title";

    -(id)initWithCoordinate:(CLLocationCoordinate2D) c{
        return self;

This class will basically show the title and the subtitle of the location on the map.

8. Lets add the function that will be called when the ‘Go’ button is tapped and this will contain the code that will actually display the address location on the map. We call that action as showAddress

    - (IBAction) showAddress {
        //Hide the keypad
        [addressField resignFirstResponder];
        MKCoordinateRegion region;
        MKCoordinateSpan span;

        CLLocationCoordinate2D location = [self addressLocation];
        if(addAnnotation != nil) {
            [mapView removeAnnotation:addAnnotation];
            [addAnnotation release];
            addAnnotation = nil;
        addAnnotation = [[AddressAnnotation alloc] initWithCoordinate:location];
        [mapView addAnnotation:addAnnotation];
        [mapView setRegion:region animated:TRUE];
        [mapView regionThatFits:region];

9. The map view basically shows the location based on its latitude and longitude but we have the address in the textual form. Therefore we need to convert this into CLLocationCoordinate2D. Note that in the above code we call the function names addressLocation to perform this conversion.

-(CLLocationCoordinate2D) addressLocation {
    NSString *urlString = [NSString stringWithFormat:@"", 
                    [addressField.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
    NSArray *listItems = [locationString componentsSeparatedByString:@","];

    double latitude = 0.0;
    double longitude = 0.0;

    if([listItems count] >= 4 && [[listItems objectAtIndex:0] isEqualToString:@"200"]) {
        latitude = [[listItems objectAtIndex:2] doubleValue];
        longitude = [[listItems objectAtIndex:3] doubleValue];
    else {
         //Show error
    CLLocationCoordinate2D location;
    location.latitude = latitude;
    location.longitude = longitude;

    return location;

The above code reads the address entered in the input box and gets the location from in CSV format. It then gets the latitude and longitude from it. The return code of 200 from google means success.

10. Finally, lets add the delegate function that will display the annotation on the map

- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{
    MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
    annView.pinColor = MKPinAnnotationColorGreen;
    annView.canShowCallout = YES;
    annView.calloutOffset = CGPointMake(-5, 5);
    return annView;

This function basically creates a annotation view (a green color pin) with the annotation that we added earlier to the MapView. Tapping on the green pin will display the title and the sub-title.

Finally, here’s how the map looks like when loaded.



So this was a very simple example of how a map can be shown from within an application. Hope this was helpful. Let me know your comments/feedback. Click here to download the code.

UPDATE: All this while Google was not looking for API key in the URL –

The URL now needs to change to –

You can obtain your API key here


Entry filed under: Geeky stuff. Tags: , .

5 mistakes that freelancers make and how to avoid them Detecting a shake using iPhone SDK

111 Comments Add your own

  • 1. dys  |  July 1, 2009 at 11:14 am

    Thanks for writing this. It works perfectly! There aren’t a lot of MapKit tutorials out there, so I’m glad I found this.

    One minor typo, though. There’s a semi-colon missing from:
    annView.canShowCallout = YES

    • 2. mithin  |  July 3, 2009 at 11:32 am

      Thanks. The missing semi-colon is now added.

  • 3. paul  |  July 3, 2009 at 7:18 pm

    Hello, really great tutorial! I went step by step through it though and I’m having some trouble getting it to work… i keep getting errors. Would it be possible for you to post the working final version of this project? that would be reallyyyy usefull to someone new to this like myself.

    Thanks in advance!

    • 4. apple1  |  July 3, 2009 at 7:24 pm

      I agree, it would be greatly appreciated if you could post a zipped up version of the working project! Thanx

      • 5. mithin  |  July 3, 2009 at 10:18 pm

        Paul, Apple1, Thanks for the feedback. I have zipped the project and have shared the link at the end of the post.

  • 6. justmobileprograms  |  July 5, 2009 at 10:43 pm

    thanks for the tutorial

  • 7. Gurpartap Singh  |  July 6, 2009 at 2:38 am

    Good stuff!

    PS: MKPinAnnotationView *annView is not released.


  • 8. Koen  |  July 6, 2009 at 11:27 pm

    Thanks! Great tutorial!

  • 9. Greg  |  July 7, 2009 at 8:21 pm

    thanks, great tutorial
    It really helped me on this issue

  • 10. Doane  |  July 13, 2009 at 8:51 pm

    Brilliant! Very helpful! How would you go about putting multiple pins on the map, and is there a way to navigate to another view when you press on a pin?

    • 11. Doane  |  July 14, 2009 at 4:19 pm

      Ok the multiple annotations was fairly obvious, got that!

      But now, for some very strange reason, I can’t change the colour of my pins. I changed it once but now my code isn’t even running through the function that displays the annotation, yet it has trouble displaying it but it simply won’t change the colour. I have no idea what’s happening here, can’t figure it out, maybe something to do with my adding the second annotation.

      • 12. mithin  |  July 14, 2009 at 9:04 pm

        Hi Doane!

        Sorry, I might not be able to help you solve your problems because of time constraints. I suggest you post your issues on some iPhone development forum. You are more likely to find a solution there.

      • 13. Doane  |  July 15, 2009 at 8:10 pm

        No problem, I just gotta fiddle with it a bit methinks! It really should be running through that delegate in order to be placing pins on the map I would have thought, don’t know how it works without it and don’t know why it isn’t calling it anyways!

        I’ll let ya know if I figure it out!

      • 14. mike  |  November 24, 2009 at 11:21 pm

        Doane, did you ever figure out how to resolve this?
        I did something to break it but I can’t seem to find how to fix it.

      • 15. Faizal  |  July 21, 2010 at 8:54 pm

        dude, I would like to know how did ya solve the multiple annotations problem. I have
        stored the lat and long in an array as [“-34.343:-34.434”] format
        so I split the string and locate. So if I have [“-34.343:-34.434”],
        [“-54.343:-24.434”] ,[“-31.343:-58.434”] ,[“-74.343:-14.434”] .
        which points to multiple locations. Now how can I locate by using
        multiple annotations..Please reply to my email address.

  • 16. Mapkit and function syntax - iPhone Dev Forums  |  July 15, 2009 at 8:39 pm

    […] Something that's confusing me a little bit, and this feels kinda like a stupid question! I did this tutorial and have since successfully incorporated it into my own project but I don't understand […]

  • 17. Doane  |  July 20, 2009 at 4:58 pm

    How do you change the title and subtitle from outside of the addAnnotation class? If I’m adding a load of annotations I don’t want the same title but I can’t figure out how to change the title property or pass in a variable

    • 18. Neill  |  August 22, 2009 at 6:06 pm

      objective-c “singletons” may help, these enable you to store global type variables temporarily. Handy.

    • 19. Matt Facer  |  August 8, 2010 at 2:42 pm

      Not sure if this is the best way, but it’s worked for me…
      in AddressAnnotation.h, (just above @end) add:

      @property (assign) NSString *mTitle;
      @property (assign) NSString *mSubTitle;

      Then in AddressAnnotation.m, change synthesize to

      @synthesize coordinate, mTitle, mSubTitle;

      Then change the strings as follows

      - (NSString *)subtitle{
      return mSubTitle;

      - (NSString *)title{
      return mTitle;

      You should then be able to set your own in your viewcontroller code, something like

      AddressAnnotation *addAnnotation = [[AddressAnnotation alloc] initWithCoordinate:newLocation];
      addAnnotation.mTitle = @"oooh a new title";
      addAnnotation.mSubTitle = @"this is the sub title body";

      That should then change the marker text. Let me know how you get on.

  • 20. Adam  |  July 20, 2009 at 10:58 pm

    “Make sure you set the delegate for the mapView to the controller class”

    Can someone explain what that really means? I can’t figure out what needs to be done. At stage 6 the app builds and launches in the simulator but nothing is displayed. I had to change one line though to get it to compile:

    mapViewController = [[MapViewController alloc…

    to MapViewController *mapViewController = [[ MapView…

    • 21. Doane  |  July 21, 2009 at 7:50 pm

      Do you have this line in your implementation:

      MapViewController *mapViewController;

      • 22. gmgm  |  November 7, 2009 at 6:05 pm

        the implementation in the MapViewController file?

        thanks for ur time 🙂

    • 23. Doane  |  July 23, 2009 at 5:32 pm

      Also, to set the delegate, open your nib, select the map view and look at it’s connections in the inspector, drag from the circle opposite “delegate” to the files owner..

      That’s what that means, and I had made the mistake of not doing that at first which meant it would work but I couldn’t figure out how to change the pincolour..

  • 24. Gary  |  July 22, 2009 at 11:34 pm

    Thanks for the tutorial! It is very helpful. But, I’m not able to get the Geocode. My listitem contains only 2 elements. The code is below;

    NSString *urllString = [NSString stringWithFormat:@””,
    [address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    NSLog(@”listItems urlString %@”,urllString);
    NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urllString]];
    NSArray *listItems = [locationString componentsSeparatedByString:@”,”];

    NSLog(@”listItems count %d”,[listItems count]);

    Count here is 2.

    Thanks a bunch!

    • 25. mithin  |  July 23, 2009 at 9:00 am

      Mostly likely the URL is not right. What happens when you paste the URL in your browser?

  • 26. jissa  |  July 23, 2009 at 11:36 am

    Thanks for the samples.
    is there any code to make the pin(MKPinAnnotationView) move when the user drag or touch?

  • 27. Doane  |  July 23, 2009 at 5:29 pm

    Why can’t I declare a string in MapViewController? I want to dynamically change the title and subtitle for multiple pins..

  • 28. Surendra  |  July 23, 2009 at 6:11 pm

    Thanks for this. It helps me a lot..

  • 29. Surendra  |  July 23, 2009 at 6:31 pm

    Can we draw multiple pins using that mapkit framework like pins for different location at same time..
    Please suggest..

    • 30. Doane  |  July 23, 2009 at 7:07 pm

      Yeah, you’re just repeating the code to add more and more annotations, like so:

      CLLocationCoordinate2D add1=mapView.userLocation.coordinate;
      CLLocationCoordinate2D add2=mapView.userLocation.coordinate;
      CLLocationCoordinate2D add3=mapView.userLocation.coordinate;
      CLLocationCoordinate2D add4=mapView.userLocation.coordinate;

      addAnnotation=[[AddAnnotation alloc] initWithCoordinate:add1];
      [mapView addAnnotation:addAnnotation];

      addAnnotation=[[AddAnnotation alloc] initWithCoordinate:add2];
      [mapView addAnnotation:addAnnotation];

      addAnnotation=[[AddAnnotation alloc] initWithCoordinate:add3];
      [mapView addAnnotation:addAnnotation];

      addAnnotation=[[AddAnnotation alloc] initWithCoordinate:add4];
      [mapView addAnnotation:addAnnotation];

      • 31. roger chan  |  January 28, 2010 at 9:01 pm

        I tried this using my derived class of AddAnnotation, but still only 1 pin appears, not sure why.

        addAnnotation=[[TheSpaceObject alloc] initWithCoordinate:add1];
        [mapView addAnnotation:addAnnotation];
        addAnnotation=[[TheSpaceObject alloc] initWithCoordinate:add2];
        [mapView addAnnotation:addAnnotation];
        addAnnotation=[[TheSpaceObject alloc] initWithCoordinate:add3];
        [mapView addAnnotation:addAnnotation];
        addAnnotation=[[TheSpaceObject alloc] initWithCoordinate:add4];
        [mapView addAnnotation:addAnnotation];

  • 32. Dustin  |  July 23, 2009 at 8:40 pm

    Thanks for the great tutorial. I have been having trouble with this before finding your tutorial. Here’s a question for you. I want to be able to feed long and lat to the map from a plist located on an online server instead of having the user put in the address. Can this be done? If so, how?


  • 33. Vijay P  |  July 24, 2009 at 8:42 am

    I mostly figured out how to do all of this stuff on my own; but this is a great tutorial. I’m trying to figure out how to get the callout to have a different (larger) size when my subtitle won’t fit in the callout. Is there any way to do this programmatically? I tried changing the view’s frame, but that didn’t seem to work so well.

  • 34. Doane  |  July 30, 2009 at 9:01 pm

    How would one put code behind a pin? Say if I want to switch views when the user clicks on a pin?

    • 35. nobody  |  August 8, 2009 at 12:15 am

      I have the same question as Doane basically. How would one have the app do something (not related to the map part at all really) when the user touches on a pin?

      • 36. Lars-Jørgen Kristiansen  |  August 8, 2009 at 5:08 pm

        Dont know about when the user pushes the pin but you could add a button to the annotation…

        Like this:

        UIButton *annotationButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [annotationButton addTarget:self action:@selector(annotationAction) forControlEvents:UIControlEventTouchUpInside];
        annView.rightCalloutAccessoryView = annotationButton;

        and put your code in

        – (void) annotationAtion {
        //code here!!

  • 37. iPhone: First map application « My tech blog diary  |  August 8, 2009 at 5:27 am

    […] Update: I found another tutorial: link. […]

  • […] for some of the code and the original idea go to Share and […]

  • 39. Neill  |  August 22, 2009 at 5:55 am

    First Class Tutorial thanks!
    Still working up to using annotations, a quick way to get the map to a specific region is to get to step 6 and then add the following into your MapViewController.m – (void)viewDidLoad { }

    Simply takes you to specific lat and lon coordinates if thats all you need.

    – (void)viewDidLoad {

    [super viewDidLoad];

    mapView.mapType = MKMapTypeStandard;
    mapView.scrollEnabled = YES;
    mapView.zoomEnabled = YES;
    // mapView.delegate = self;

    CLLocationCoordinate2D coords;
    coords.latitude = 55.948815;
    coords.longitude = -3.194790;
    MKCoordinateSpan span;

    mapView.region = MKCoordinateRegionMake( coords, span );



  • 40. Shinto Joseph  |  August 31, 2009 at 12:19 pm

    superb Tutorial, thanks

    i like to know , how can i put some custom images instead of the pin (like GIcon in google maps API) and is there any way to show the driving directions between two points ?

    thanks in advance…

    • 41. hassan ali  |  October 23, 2010 at 9:46 am

      hi i am a software engg student . and i have a final year project about iphone . and you have ask a question at August 31, 2009
      about the iphone mapkit tutorial . that how to put images instead of the pins. and how to show the diectiion between to points?
      plz help me i cann’t find any ans of that if you have find the ans plz send it to my email
      thanks in advance

  • 42. Nilshan  |  August 31, 2009 at 7:15 pm

    This tutorial is really helpful.

    Is there any way load Custom Map ( Hospital Map ) and add
    annotation on that.

    I want to add Hospital Layout Map using MKMapView. In MKMapView I want to add Annotations like chairs , bed. etc.

    Is there any way to get it done. ! Is there any work around to achieve this.


  • 43. Mohit  |  September 6, 2009 at 4:45 pm

    This is no doubt awesom tutorail with excellent readability.
    Thanks brother for saving my many working hour for this solution…


  • 44. aasdf  |  September 9, 2009 at 6:26 am

    You forgot
    AddressAnnotation *addAnnotation;

    in the declaration in the html-version of the code.. 🙂

    Thanks for a great tutorial, appreciate your time!

  • 45. kish  |  September 22, 2009 at 12:43 pm

    superb tutorial thanks,

    now i have some problem with loading custom information into callout buble instead of title and subtitle…can any one know how to do

    thanks in advance

  • 46. tnathos  |  September 23, 2009 at 10:08 pm

    Hi, great tuto.. but how i can put more lines to the subtitle?

  • 47. iPhone tutorial Sammlung 1: MapKit « Alexander Jäger  |  September 30, 2009 at 6:15 pm

    […] sehr gute Lösung […]

  • 48. Daz  |  October 6, 2009 at 9:34 pm


    • 49. leyarga  |  October 6, 2009 at 11:50 pm

      I have the same problem explained at comment 17. I’m not able to display the map. The simulator can’t display the map and is not able to launch the application!
      Somebody help me please!!!

      • 50. leyarga  |  October 7, 2009 at 12:52 am

        I find the solution. mapKit framework was missing and i coudn’t take it from the way discribed at point 2.
        I was having this error:

        Terminating app due to uncaught exception ‘NSInvalidUnarchiveOperationException’, reason: ‘Could not instantiate class named MKMapView’

        The right way to add a framework and to avoid this error is :

        -Double click on project target
        -Go to General
        -Click on +
        -Add the chosen framework

        thanks for this good tutorial

  • 51. Paul  |  October 21, 2009 at 2:21 pm

    Great tutorial thank you!

    A couple of questions:

    1. In your response at [26] how would you go about naming the additional addresses from an array member?

    I’ve tried things like CLLocationCoordinate2D [myArray objectAtIndex:0] but not having any luck.

    2. Are we able to use this code in our own projects?

    • 52. Paul  |  October 21, 2009 at 7:56 pm

      OK, so I’ve managed to get the array working (I needed to remove the bit about if annotation is nil)

      But I would love to know how to set the annotation title to something meaningful for each array member?

  • 53. Sam  |  October 22, 2009 at 9:49 am

    I ran the code proviced by you but I am getting 610,0,0,0 as the returned error.

    Please let me know what I am doing wrong. I entered Los Angeles in the text box.


  • 56. Deepak Sahu  |  October 26, 2009 at 4:46 pm

    It is really Great tutorial and helpful
    Thank You!

  • 57. Gaurav Jain  |  October 30, 2009 at 7:20 pm

    Hi , I am trying to use the same code but its throwing an error saying : ” expected specifier-qualifier-list before MKMapview”

    • 58. Rhett Maxwell  |  May 1, 2010 at 4:36 pm

      The case is wrong on MKMapView. The V should be capitalized.

  • 59. gmgm  |  November 7, 2009 at 5:42 pm

    is there a reason that i cant get step 5 to work? i think it is just me being stupid and not doing something, i just cant work it out!!

    It’s saying that ‘mapViewController’ undeclared!

    Please help me someone!?

    Thank you! Great tutorial though 🙂

    • 60. Tarun Sharma  |  November 24, 2009 at 4:21 pm

      write in delegate’s header file:
      MapViewController *mapViewController;

      • 61. Florian  |  February 9, 2010 at 11:39 pm

        There’s a few statements missing in the instructions:

        1. update the delegate File to release the MapViewController as follows:

        – (void)dealloc {
        [mapViewController release]; !!!
        [window release];
        [super dealloc];

        2. Add
        class MapViewController;
        in delegate’s header file, and

        3. Add
        MapViewController *mapViewController;
        in delegate’s header file to that it shows


        @class MapViewController;

        @interface MapAppAppDelegate : NSObject {
        UIWindow *window;
        MapViewController *mapViewController;


  • 62. prs  |  November 9, 2009 at 9:38 am

    hey, great tutorial!
    I have a couple of doubts:

    1. What is a protocol as opposed to a class? We had to create AddressAnnotation Class to pass on to MKMapView:addAnnotation instead of passing a direct object of MKAnnotation ?

    2. where does the delegate function in the last step sit in? it is not called not anywhere else. is it embedded inside addAnnotation fucntion?


  • 63. Mark  |  November 12, 2009 at 6:21 pm

    Excellent tutorial. Thank you so much!

  • 64. Andy  |  November 17, 2009 at 12:49 am

    Hi, I’m having the exact same problem as gmgm, when i try to run it in step 6, it says mapViewController and MapViewController are undeclared, any help please I’m desperate?


    • 65. mithin  |  November 17, 2009 at 10:43 am

      I just downloaded the code from the download link in the post. The code builds fine without any error. Can you explain your build steps and error?

      • 66. Andy  |  November 17, 2009 at 5:53 pm

        Hi i think i figured it out, being unfamiliar with the SDK, i created the /xib file under classes, when i downloaded your code, the xib was under resources, i ran your code and it works fine, cheers.

  • 67. Tarun Sharma  |  November 24, 2009 at 4:04 pm

    hi .. it was an awesome tutorial. I made my first map application using this tutorial..Hats off to u.. great job.

  • 68. neha P  |  November 24, 2009 at 5:42 pm

    hello! Simply great… thanx for such a tutorial…!

  • 69. mike  |  November 24, 2009 at 11:18 pm

    I am having the same problems as post 11 and 13. It was working fine and now it does not execute the overriden viewForAnnotation method.
    I could change the pin colors, etc. but now it defaults to the standard annotation red and will not execute my viewForAnnotation for customization.

    Doane, did you ever find out how to resolve this??


  • 70. Bugle Diary  |  November 26, 2009 at 9:38 pm

    [Objective-C][iPhone sdk][google maps]pinを表示その3…


  • 71. suresh thorata  |  December 9, 2009 at 12:27 pm

    Hi, that was a useful tutorial.
    Is there any way to show the driving directions between two points ?

  • 72. nextTime  |  January 11, 2010 at 1:02 am

    Two things that would have made this tutorial better. Instructions as to what class files to place certain methods in, you have to end up guessing.
    Also, complete step by step instructions, if you follow this tutorial to the letter it won’t compile, there are so many things missing. If you compare the final code to what the tutorial tells you to do, it’s completely different.

  • 73. Gary  |  February 12, 2010 at 3:39 pm

    Thanks a lot for the excellent tutorial!

    Hope you help me on this one:

    I am using the “” to get the coordinates from the input address, but for some UK Post Code, the coordinates returned from the csv file from google are wrong. However, the google map website itself points to the right position!

    Does google web site itself use something else different from the coordinates they return in the csv file?

    Hope can get your expertise help!



  • 75. plantaapps  |  March 16, 2010 at 4:34 am

    this is awesome tutorial!!!! thank you so much!!!!!
    can you make a tutorial about making customised pins like they did in this app:

  • 76. Zeeshan Khan  |  March 19, 2010 at 8:21 pm

    Thank you so much for this code.
    It works perfectly.
    It is very useful and nice article.

    Cheers 🙂

  • 77. Adoption Curve » Blog Archive » links for 2010-03-30  |  March 31, 2010 at 6:01 am

    […] Using iPhone SDK MapKit Framework – A tutorial « The Spoken Word Lets create a simple application which displays the address entered by the user on the map within the application. We’ll call it MapApp. (tags: mapkit iphone objectivec development) […]

  • 78. Pravin  |  April 3, 2010 at 1:15 pm

    Hi, This is good tutorial f ro start using MapKit framework.
    I start my first Mapkit app with the help of this tutorial.
    What I found that in search result it shows only single annotation pin at a time. I did not get multiple annotation in search result.
    Please advise, How to show the multiple annotations in search result?

  • 79. imen  |  May 12, 2010 at 3:15 pm

    bj I have a problem for the choice of what we will MAPkit.Frameork chosen please help me thank you in advance

  • 80. imen  |  May 12, 2010 at 3:56 pm

    I have a pb power of the Istalif MapKit.frameork please can you help me I made the addition of a new framework after the following path (Mapka Add the framework to the project. (Control + Click Frameworks folder -> Add -> Existing Frameworks)). but nothing happens because I find this pusieurs framework and I chose the framework that is located immediately following emlacement / develop / platform / iPhoneOS; plateform/Developer/SDKs/iphoneOS3; 0; sdk / system / library / frameorks

  • 81. Raxit Pandya  |  May 15, 2010 at 3:42 pm

    It is really outstanding tutorial. I like it very much. It’s really very useful to all people working in iphone domain. Great.

    All the Best and keep it up

  • 82. 2010-05-25(MyTracks)  |  May 28, 2010 at 5:53 am

    […] map code Posted by admin iphone资讯 Subscribe to RSS feed  […]

  • 83. RightScanner  |  June 1, 2010 at 11:02 pm

    This article has been copied at the following without referring the source.

  • 84. krom  |  June 2, 2010 at 4:50 am

    Google is returning a GEO CODE of 602 for unknown address. I am building directly from the code posted for download and updated the http request with my API key. Any ideas why?

    Thank you

    • 85. krom  |  June 2, 2010 at 5:04 am

      Turns out if I don’t use the API key the map works as expected.

  • 86. Sahil  |  June 3, 2010 at 3:32 am

    Actually there is problem in addAnnotation in map because first of all you check addAnnotaion is nil or not if it is not nil then you release it and then you add this annotation in map and here application crash because you add annotation in map which is not exist.
    if(addAnnotation != nil)
    [mMapView removeAnnotation:addAnnotation];
    [addAnnotation release];
    addAnnotation = nil;
    please also expalin this if else part.

    • 87. Daniel Kubitza  |  June 10, 2010 at 6:07 pm

      you have to add:

      AddressAnnotation *addAnnotation;

      in your header file.

      And there is no else part needed. This will release the first Annotation when one was set. So you have only one Annotation.

  • 88. bkbroiler  |  June 7, 2010 at 9:46 am

    Excellent tutorial. I would like to fold this into a multi-view application, for example using a navigation bar, but I cannot seem to get that to work right. I guess it is a bit much to ask but an addendum expanding the application in such a way would be greatly appreciated!

  • 89. chennareddy  |  June 14, 2010 at 1:05 pm

    this is a good tutorial to learn mkmap simply super

  • 90. aldrin  |  June 16, 2010 at 1:29 am

    This is an excellent piece of tutorials but as a newbie to xcode, I am stuck at step 4. Okay this is very stupid, how do I actually add the textfield, button and MKMapview under view?

  • 91. First look at iPad Development « Oba's SandBox  |  June 18, 2010 at 3:55 am

    […] and didn’t know that it needed some extra project settings to work. Answer found here (solution was to link the MapKit.framework […]

  • 92. Angad SOni  |  June 22, 2010 at 9:20 am

    Great tutorial thanks a ton. I’m kind of a new on iPhone development i was wondering if there was any way to show where the user is on the map. Like the users location is a pin as well on the map….

    Thanks in advance.

    • 93. Fauad Anwar  |  July 9, 2010 at 3:44 pm

      use Interface builder and check the check box of “show my location”.

  • 94. Rahmat Hidayat  |  July 4, 2010 at 5:41 pm

    What version of the SDK were you using? some of the methods are deprecated

  • 95. Lilanga  |  July 13, 2010 at 5:15 pm

    Thank you So much for the tutorial.

    stringWithContentsOfURL: is Deprecated in OS 4.0
    I Used
    NSError* error;
    NSString* locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString] encoding:NSASCIIStringEncoding error:&error];

    insted of
    NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];

  • 96. vinh  |  August 6, 2010 at 7:21 am

    Thank you very much for sharing useful information about MapKit.

  • 97. Ross  |  August 10, 2010 at 8:27 am

    I was wondering if you could tell me how I could remove the text box and have the map automatically go to a specified Lat/Lon?

    • 98. Ross  |  August 10, 2010 at 8:33 am

      Hi again,
      I figured out how to get it to go to a specified Lat/Lon, but now how can I set it to zoom in more that it already does and make it automatically go to the location without pressing go?

  • 99. sandeep  |  August 17, 2010 at 5:35 pm


    Thanks for this tutorial.

    I want more detail about map view annotation. What will be the procedure to get coordinate of point when we touch on map?
    Or please suggest me the MapView delegate method to do this.

    Thanks in Advance.

  • 100. charlie  |  August 31, 2010 at 2:01 pm

    hi,, thanks for this tutorial,, it’s work when i tried..
    but i have some trouble when i want to set the sub title with text in the addressField. i change the construction of

    -(id)initWithCoordinate:(CLLocationCoordinate2D) c{
    return self;

    with this

    -(id)initWithCoordinate:(CLLocationCoordinate2D) c title:(NSString *) nTitle subtitle: (NSString *) nSubtitle{
    mTitle = nTitle;
    mSubTitle = nSubtitle
    return self;

    then i have change this :
    – (NSString *)subtitle{
    return self.mSubTitle;

    – (NSString *)title{
    return self.mTitle;

    it work if i fill the addressField with string without ” “(space),
    but when i add ” ” with that input, it will terminated


  • 101. ak  |  September 7, 2010 at 9:14 am

    hi,, thanks for this tutorial !
    but i have some trouble that I want to make a annotation when I touch the sreen and catch the event ,and I want to get the map point and coordinate. how can I get it?

  • 102. alok  |  September 7, 2010 at 6:17 pm

    really … much impressive…

  • 103. kb1ooo  |  September 16, 2010 at 8:16 am

    Nice tutorial. Though it looks like you have a leak in your delegate -[mapView:viewForAnnotation]

    fixed by changing last line to

    return [annView autorelease];

    Also, might be nice to show how to use the reuse identifier.


  • 104. Abhi  |  September 28, 2010 at 12:17 am

    CLLocationCoordinate2D location = [self addressLocation];

    I am getting invalid initializer error on the above line, I used same code.
    Any suggestion?

  • 105. iPhoneDev  |  October 19, 2010 at 1:55 pm

    thanks for being so thoughtful to write this tutorial for others 🙂

  • 106. Ali  |  October 21, 2010 at 1:54 pm

    I tried to implement it but I failed.Can anyone help. Are we suppose to have code #7-10 in the same file?

  • 108. Lisette  |  March 17, 2013 at 8:10 pm

    The Fat Loss Factor Product is one of the numerous common diet plans which are right
    now grasping this particular appearance mindful region.
    It is often produced by a wife and husband tandem — Medical professional.
    Michael Allen and also Lori. Both of them ended up overweight people however following a series
    of self-experimentation, they have made a mixture
    of dietary as well as actual components that will caused by how
    much they weigh damage. At the moment, due to so-called program, vehicle taking pleasure in their own healthy new curves.
    Fat reduction Manufacturer Method is a new 12-week long program so
    that as it turned out pointed out, that includes electrical power education
    and also nutritional tips. The 1st step for your eating plan is actually cleansing.
    Which means you will have to eliminate people harmful toxins inside
    your system by using the extremely specialized system with the eating habits.
    After this you must concentrate along with urge for food in order to
    healthy proteins as well as fiber-rich carbohydrate food.

  • 109. best longchamp bag  |  October 23, 2013 at 12:58 am

    Using iPhone SDK MapKit Framework – A tutorial | The Spoken Word
    best longchamp bag

  • 110. longchamp lepliage  |  October 23, 2013 at 12:58 am

    Using iPhone SDK MapKit Framework – A tutorial | The Spoken Word
    longchamp lepliage

  • 111. longchamp le pliage medium tote  |  October 23, 2013 at 12:59 am

    Using iPhone SDK MapKit Framework – A tutorial | The Spoken Word
    longchamp le pliage medium tote


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


  • RT @beeonaposy: Jumping back into code you wrote ages ago like 10% luck 20% skill 15% concentrated power of will 5% pleasure… 2 weeks ago
  • RT @jimmysong: Stuff CS departments should teach, but don't do very well: * Source control, esp. git * How to do effective code review * H… 1 month ago
  • RT @farbodsaraf: Advice to new managers: 1 earn trust by giving it 2 hire for EQ, train for IQ 3 eat lunch with your team 4 tell people t… 1 month ago


%d bloggers like this: