4

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

MvxBind:警告:1.29 无法为 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();

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

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

谢谢你的帮助!

4

1 回答 1

7

这种类型的消息——再加上“它在模拟器中工作”的证据——几乎总是意味着链接器已经删除了符号。

除了“将项目设置更改为链接所有程序集”之外,您是否可以在“LinkerPleaseIgnore.cs”(或其他文件)中添加一行来欺骗链接包含事件。

例如包含一个像https://github.com/slodge/NPlus1DaysOfMvvmCross/blob/master/N-38-Maps/Mappit.Touch/LinkerPleaseInclude.cs这样的文件,方法如下:

    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符号

于 2013-09-30T20:15:11.193 回答