Bug 41129 - "Add an Annotation to a Map" recipe has wrong code on the site.
Summary: "Add an Annotation to a Map" recipe has wrong code on the site.
Status: RESOLVED FIXED
Alias: None
Product: Documentation
Classification: Xamarin
Component: Recipes ()
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: CraigD
URL:
Depends on:
Blocks:
 
Reported: 2016-05-17 12:17 UTC by Fabio Garagiola
Modified: 2016-05-17 21:43 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Fabio Garagiola 2016-05-17 12:17:04 UTC
The recipe "Add an Annotation to a Map" at:

https://developer.xamarin.com/recipes/ios/content_controls/map_view/add_an_annotation_to_a_map/

has wrong code in "Create a subclass of MKAnnotation:".

The correct code is the following:

public class BasicMapAnnotation : MKAnnotation
{
    string title, subtitle;
    CLLocationCoordinate2D coordinates;

    public override CLLocationCoordinate2D Coordinate { get { return coordinates; } }
    public override string Title { get { return title; } }
    public override string Subtitle { get { return subtitle; } }

    public override void SetCoordinate(CLLocationCoordinate2D value)
    {
        coordinates = value;
    }

    public BasicMapAnnotation(CLLocationCoordinate2D coordinate, string title, string subtitle)
    {
        this.SetCoordinate(coordinate);
        this.title = title;
        this.subtitle = subtitle;
    }
}
Comment 1 CraigD 2016-05-17 21:43:44 UTC
You are correct - the recipe code was incorrect and has been updated.
Thanks for letting us know!