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