C# MKMapView-可拖动引脚导致跌落错误?

C# MKMapView-可拖动引脚导致跌落错误?,c#,ios,xamarin.ios,mkmapview,selector,C#,Ios,Xamarin.ios,Mkmapview,Selector,是否有人遇到此错误(见下文)。当我在MKMapView中拖动一个管脚,然后将其放下时,会发生这种情况。。。当应用程序被删除时崩溃。我的MKAnnotation实现也有一个坐标的getter/setter System.Exception: Failed to find selector _original_setCoordinate: on DivineiPhone.FoundAnnotation at MonoTouch.ObjCRuntime.Runtime.GetMethod (Int

是否有人遇到此错误(见下文)。当我在MKMapView中拖动一个管脚,然后将其放下时,会发生这种情况。。。当应用程序被删除时崩溃。我的MKAnnotation实现也有一个坐标的getter/setter

System.Exception: Failed to find selector _original_setCoordinate: on DivineiPhone.FoundAnnotation
  at MonoTouch.ObjCRuntime.Runtime.GetMethod (IntPtr klass, IntPtr selptr) [0x0001c] in /Users/plasma/Source/iphone/monotouch/ObjCRuntime/Runtime.cs:127
  at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetMethod (intptr,intptr)
  at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:26
  at DivineiPhone.Application.Main (System.String[] args) [0x00000] in /Users/stevepthornton/Projects/DivineiPhone/DivineiPhone/Classes/Main.cs:15
谢谢你的帮助。。。我不知道发生了什么事:(

史蒂夫

这是我的密码

public class FoundAnnotation : MKAnnotation
    {
        private CLLocationCoordinate2D coordinate;

    private string _title, _subtitle;
    private bool _clickThru;
    private string _desc;

    public override CLLocationCoordinate2D Coordinate 
    {
        set { coordinate = value; }
        get { return coordinate; }
    }

    public override string Title 
    {
        get { return _title; }
    }

    public override string Subtitle 
    {
        get { return _subtitle; }
    }

    public bool ClickThru 
    {
        get { return _clickThru; }
        set { _clickThru = value; }
    }

    public string Description 
    {
        get { return _desc; }
        set { _desc = value; }
    }

public FoundAnnotation (CLLocationCoordinate2D coord, string t, string s, bool click, string description) : base()
{

        coordinate=coord;
        _title=t; 
        _subtitle=s;
        _clickThru = click;
        _desc = description;
    }
}

public override MKAnnotationView GetViewForAnnotation (MKMapView mapView, NSObject annotation)
        {   
            try
            {
                if (annotation is MKUserLocation)
                {

                return null; //default to blue dot
            }
            else if (annotation is FoundAnnotation)
            {
                MKPinAnnotationView pinanv = new MKPinAnnotationView(annotation, "thislocation");
                pinanv.AnimatesDrop = true;
                pinanv.PinColor = MKPinAnnotationColor.Green;

                FoundAnnotation customAnnotation = (FoundAnnotation)annotation;
                pinanv.CanShowCallout = true;

                UIButton rightCallout = UIButton.FromType(UIButtonType.ContactAdd);
                rightCallout.Frame = new System.Drawing.RectangleF(250, 8f, 25f, 25f);

                rightCallout.TouchDown += delegate {
                    addStore = new AddStoreViewController(this, customAnnotation, mapView);
                    _svc.NavigationController.PushViewController(addStore, true);
                };

                pinanv.RightCalloutAccessoryView = rightCallout;
                pinanv.Draggable = true;

                return pinanv;
            }
            else if (annotation is StoreAnnotation)
            {
                MKPinAnnotationView pinanv = new MKPinAnnotationView(annotation, "thislocation");
                pinanv.AnimatesDrop = true;
                pinanv.Image = UIImage.FromFile("Images/MapPin.png");
                pinanv.CanShowCallout = true;

                return pinanv;
            }

            return null;
        }
        catch (Exception ex)
        {
            return null;
        }
    }

这是一个选择器被重命名(在运行时)的问题。更多详细信息(和测试用例)可用


修复程序将在MonoTouch 4.1中提供。

从MonoTouch 5.2.5开始,此错误仍然存在。上述错误仍然存在,解决方法(导出原始设置坐标:)将修复它。

这仍在MonoTouch 5.2.5上发生。如以下代码修复之前所述:

public override CLLocationCoordinate2D Coordinate 
{ 
    get 
    { 
        return this.coordinate; 
    }
    set
    {
        this.SetCoordinate(value);
    }
}

[Export("_original_setCoordinate:")]
public void SetCoordinate(CLLocationCoordinate2D coord)
{
    this.WillChangeValue("coordinate");
    this.coordinate = coord;
    this.DidChangeValue("coordinate");
}

如果您发布了一个有问题的代码示例,它将有所帮助。它已经被修复,新的修复将在MonoTouch 5.3中提供。