[Xamarin] [Mvvmcross]无法查找所需的编组信息

问题描述

我正在为iOS项目关注mvvmcross tutorial。我认为我正在为此做确切的描述,但是当我运行应用程序时,出现以下错误

ObjCRuntime.RuntimeException
  Message=Failed to lookup the required marshalling @R_610_4045@ion.
Additional @R_610_4045@ion:
    Selector: setGenerositySlider:
    Type: TipView

  Source=
  StackTrace:
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args,system.intPtr principal,system.intPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args,System.String principalClassName,System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.2.0.12/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at TipCalc.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\MYUSERNAME\source\repos\xamarin\TipCalc.Core\TipCalc.iOS\Main.cs:12 

我从样本中克隆了相同的项目,并且运行良好。我认为我已尽力比较了所有项目,据我所知,项目是相同的。

namespace TipCalc.iOS
{
    public class Application
    {
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args,null,"AppDelegate");
        }        
    }
}
namespace TipCalc.iOS
{
    [Register(nameof(AppDelegate))]
    public class AppDelegate : MvxApplicationDelegate<MvxIosSetup<App>,App>
    {
        public override UIWindow Window { get; set; }

        public override bool FinishedLaunching(UIApplication application,NSDictionary launchOptions)
        {
            var result = base.FinishedLaunching(application,launchOptions);

            return result;
        }
    }
}
public partial class TipView : MvxViewController<Tipviewmodel>
    {
        public TipView() : base(nameof(TipView),null)
        {
        }

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var set = this.CreateBindingSet<TipView,Tipviewmodel>();
            set.Bind(TipLabel).To(vm => vm.Tip);
            set.Bind(SubTotalTextField).To(vm => vm.SubTotal);
            set.Bind(GenerositySlider).To(vm => vm.Generosity);
            set.Apply();

            View.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                this.SubTotalTextField.ResignFirstResponder();
            }));
        }
    }

后面生成代码

namespace TipCalc.iOS
{
    [Register ("TipView")]
    partial class TipView
    {
        [Outlet]
        [GeneratedCode ("iOS Designer","1.0")]
        UiSlider GenerositySlider { get; set; }

        [Outlet]
        [GeneratedCode ("iOS Designer","1.0")]
        UITextField SubTotalTextField { get; set; }

        [Outlet]
        [GeneratedCode ("iOS Designer","1.0")]
        UILabel TipLabel { get; set; }

        void ReleaseDesignerOutlets ()
        {
            if (GenerositySlider != null) {
                GenerositySlider.dispose ();
                GenerositySlider = null;
            }

            if (SubTotalTextField != null) {
                SubTotalTextField.dispose ();
                SubTotalTextField = null;
            }

            if (TipLabel != null) {
                TipLabel.dispose ();
                TipLabel = null;
            }
        }
    }
}

在这里想念什么?

解决方法

我没有设置File的Owners类,添加它解决了该问题。 enter image description here