本文介绍了MvvmCross Monotouch - 无法在真正的 iPad 上绑定属性,但它适用于模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 MvvmCross Monotouch.

I am working with MvvmCross Monotouch.

这是在 iOS 模拟器上实际运行良好的绑定代码.

Here is the Binding Code that actually works very well on the iOS Simulator.

{ this, "{'Title':{'Path':'NavigationBarTitle'}}

但是,当我将它部署到我的真实 iPad (iPad 2) 上时,它不起作用.

However, it does not work when I deploy it on my real iPad (iPad 2).

Application Output:
===================
MvxBind: Warning:   0.69 Failed to create target binding for from NavigationBarTitle to Title

我很高兴看到它可以在 iOS 模拟器上运行,但是有什么理由不能在真正的 iPad 上运行吗?

I am glad to see it works on the iOS Simulator but, is there any reason why it does not work on the real iPad?

帕特里克

推荐答案

我见过这种类型的错误发生的一种情况是在发布版本中,单点链接器优化图像大小并删除绑定所需的明显未使用的属性.

One situation I've seen this type of error occur in is in release builds where the monotouch linker optimises the image size and removes the apparently unused property required for binding.

为了解决这个问题,我通常会包含一段假代码来欺骗链接器包含所需的属性 - 例如这是一个做同样事情的 monodroid 示例文件:

To workaround this, I generally include a fake bit of code to trick the linker into including the required properties - e.g. Here's a monodroid sample file which does the same sort of thing:

https://github.com/slodge/MvvmCross/blob/master/Sample%20-%20BestSellers/BestSellers/BestSellers.Droid/LinkerIncludePlease.cs

这是目前使用 mvvmcross 的缺点之一 - 它可能导致更大的二进制图像尺寸.

This is one of the disadvantages of using mvvmcross currently - it can lead to larger binary image sizes.

这篇关于MvvmCross Monotouch - 无法在真正的 iPad 上绑定属性,但它适用于模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 23:29