为了减小应用程序的大小,我在我的 Xamarin.iOS 应用程序上启用了“链接所有程序集”选项。不幸的是,当我启动应用程序时,传递简单的 View 模型参数不起作用。在应用程序输出中,我可以看到以下警告:
mvx:Diagnostic: 1.93 Missing parameter for call to ViewModel - missing parameter isLaunchedForTheFirstTime - assuming null - this may fail for value types! <br/><br/>mvx:Error: 1.94 Failed to parse BoolParser parameter isLaunchedForTheFirstTime from string
我不知道要向 LinkerPleaseInclude.cs 添加什么才能使其正常工作。有什么想法吗?
提前致谢!
编辑:
这是我的 preserve.xml 文件,其中包含所有引用的程序集:
http://pastebin.com/cEmLDxqn
还有我的 View 模型导航:
ShowViewModel<FirstViewModel>(new {isLaunchedForTheFirstTime = true})
[ImplementPropertyChanged]
public class FirstViewModel : MvxViewModel
{
//properties
public void Init(bool isLaunchedForTheFirstTime)
{
//handling parameter
}
}
最佳答案
并非所有时间链接器都足够智能以检测项目运行所需的一切,尤其是在您使用 DI 或反射时。在这些情况下,您可以 configure它包含它可能遗漏的程序集/类型或方法。
关于c# - MvvmCross - 启用链接所有程序集时缺少 View 模型参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32067695/