MvvmCross无法在iPhone上为EditingDidBegin创建目标绑定 [英] MvvmCross Failed to create target binding for EditingDidBegin on iPhone

查看:42
本文介绍了MvvmCross无法在iPhone上为EditingDidBegin创建目标绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绑定到EditingDidBegin的应用程序.它在iPhone模拟器(iOS 7)上运行良好,但是在实际的iPhone上运行时,我收到以下警告消息:

I have an application which binds to EditingDidBegin. It works fine on the iPhone Simulator (iOS 7) but when running on an actual iPhone I get the following warning message:

MvxBind:警告:1.29无法为EditingDidBegin创建目标绑定

MvxBind:Warning: 1.29 Failed to create target binding for to EditingDidBegin

控件的绑定代码为:

var set = this.CreateBindingSet<InventoryBalanceView, InventoryBalanceViewModel>();
set.Bind(StoreroomLabel).To(vm => vm.StoreRoomCaption);
set.Bind(StoreroomTextField).To(vm => vm.StoreRoom);
set.Bind(ItemNumberLabel).To(vm => vm.ItemNumberCaption);
set.Bind(ItemNumberTextField).To(vm => vm.ItemNumber);
set.Bind(BinNumberLabel).To(vm => vm.BinNumberCaption);
set.Bind(BinNumberTextField).To(vm => vm.BinNumber);
set.Bind(QuantityLabel).To(vm => vm.QuantityCaption);
set.Bind(QuantityTextField).To(vm => vm.Quantity);
set.Bind(SubmitButton).To(vm => vm.SetFocusCommand);
set.Bind(DeleteButton).To(vm => vm.DeleteCommand);
      set.Bind(NavigationItem.RightBarButtonItem).To(vm => vm.ScanStoreRoomCommand);
set.Bind(DeleteButton).For(b => b.Hidden).To(vm => vm.IsDeleteButtonHidden);

set.Bind(SubmitButton).For("Title").To(vm => vm.SubmitButtonTitle);
set.Bind(DeleteButton).For("Title").To(vm => vm.DeleteButtonTitle);

set.Bind(StoreroomTextField).For("EditingDidBegin").To(vm =>  vm.SetFocusCommand).CommandParameter("StoreRoom");
set.Bind(ItemNumberTextField).For("EditingDidBegin").To(vm => vm.SetFocusCommand).CommandParameter("ItemNumber");
set.Bind(BinNumberTextField).For("EditingDidBegin").To(vm => vm.SetFocusCommand).CommandParameter("BinNumber");
set.Bind(QuantityTextField).For("EditingDidBegin").To(vm => vm.SetFocusCommand).CommandParameter("Quantity");

set.Apply();

我确实将项目设置更改为链接所有程序集",但这似乎对该问题没有任何影响.

I did change the project settings to Link All Assemblies, but that doesn't seem to have had any impact on the issue.

您知道我的代码有什么问题,或者如何解决此问题吗?

Any idea what's wrong with my code, or how to troubleshoot the issue?

感谢您的帮助!

推荐答案

这种消息-加上它在模拟器中起作用"的证据-几乎总是表示链接器已删除该符号.

This type of message - coupled with the 'it works in the simulator' evidence - almost always means that the linker has removed the symbol.

您可以向"LinkerPleaseIgnore.cs"(或其他文件)添加一行,而不是将项目设置更改为链接所有程序集",从而欺骗链接以包括事件.

Instead of "change the project settings to Link All Assemblies", can you add a line to "LinkerPleaseIgnore.cs" (or to some other file) which tricks the linked into including the event.

例如包含类似 https://github.com/slodge/的文件NPlus1DaysOfMvvmCross/blob/master/N-38-Maps/Mappit.Touch/LinkerPleaseInclude.cs ,其方法如下:

e.g. include a file like https://github.com/slodge/NPlus1DaysOfMvvmCross/blob/master/N-38-Maps/Mappit.Touch/LinkerPleaseInclude.cs with a method like:

    public void Include(UITextField textField)
    {
        textField.Text = textField.Text + "";
        textField.EditingChanged += (sender, args) => { textField.Text = ""; };
        textField.EditingDidBegin += (sender, args) => { textField.Text = ""; };
        textField.EditingDidBegin -= (sender, args) => { textField.Text = ""; };
    }

这将希望使链接程序包含textField.EditingDidBegin符号

This will hopefully trick the linker into including the textField.EditingDidBegin symbol

这篇关于MvvmCross无法在iPhone上为EditingDidBegin创建目标绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆