CrittercismIOS 与 MvvmCross 冲突

CrittercismIOS conflict with MvvmCross

我正在通过 CrittercismIOS 集成崩溃报告,并且我在 Xamarin 组件商店上使用了组件

https://components.xamarin.com/view/crittercism

但应用崩溃并报告错误。

2015-11-25 10:49:50.621 MyApp[40227:2065265] critical: Stacktrace:

2015-11-25 10:49:50.621 MyApp[40227:2065265] critical:   at <unknown> <0xffffffff>
2015-11-25 10:49:50.621 MyApp[40227:2065265] critical:   at System.Reflection.MonoCMethod.InternalInvoke (object,object[]) [0x00016] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:650
2015-11-25 10:49:50.621 MyApp[40227:2065265] critical:   at System.RuntimeType.CreateInstanceMono (bool) [0x000ca] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/ReferenceSources/RuntimeType.cs:113
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical:   at System.RuntimeType.CreateInstanceSlow (bool,bool,bool,System.Threading.StackCrawlMark&) [0x0001a] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/ReferenceSources/RuntimeType.cs:87
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical:   at System.RuntimeType.CreateInstanceDefaultCtor (bool,bool,bool,System.Threading.StackCrawlMark&) [0x0002a] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/rttype.cs:5734
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical:   at System.Activator.CreateInstance (System.Type,bool) [0x00040] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/activator.cs:214
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical:   at System.Activator.CreateInstance (System.Type) [0x00000] in /Users/builder/data/lanes/2356/9ce9e8b9/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/activator.cs:147
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.Touch.Views.MvxTouchViewsContainer.CreateViewOfType (System.Type,Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00077, 0x002fb>
2015-11-25 10:49:50.622 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.Touch.Views.MvxTouchViewsContainer.CreateView (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x0003e, 0x0018f>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.Touch.Views.MvxCanCreateTouchViewExtensionMethods.CreateViewControllerFor (Cirrious.MvvmCross.Touch.Views.IMvxCanCreateTouchView,Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00007, 0x0004a>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.Show (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00003, 0x00037>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher/<>c__DisplayClass4.<ShowViewModel>b__3 () <IL 0x00028, 0x00090>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.Touch.Views.MvxTouchUIThreadDispatcher.RequestMainThreadAction (System.Action) <IL 0x00028, 0x000e8>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher.ShowViewModel (Cirrious.MvvmCross.ViewModels.MvxViewModelRequest) <IL 0x00024, 0x0015b>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.ViewModels.MvxNavigatingObject.ShowViewModelImpl (System.Type,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.MvxRequestedBy) <IL 0x00030, 0x00145>
2015-11-25 10:49:50.623 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.ViewModels.MvxNavigatingObject.ShowViewModel (System.Type,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.MvxRequestedBy) <IL 0x00006, 0x0004f>
2015-11-25 10:49:50.624 MyApp[40227:2065265] critical:   at Cirrious.MvvmCross.ViewModels.MvxNavigatingObject.ShowViewModel<T_REF> (Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.IMvxBundle,Cirrious.MvvmCross.ViewModels.MvxRequestedBy) <IL 0x0000e, 0x0005b>

Xamarin Component Store 上的 MvvmCross 版本是 3.5.1 和 Crittercism 2.4。

如果我在 FinishedLaunching 中删除此代码

CrittercismIOS.Crittercism.Init("00ac4950703d418c9cef9b7818cc307300444503");

应用程序工作正常(它也可以与 Xamarin.Insight 一起工作,但不可能同时使用这两个 dll)。

对于 MvvmCross,您应该将 Crittercism 初始化放在 Setup.cs class.

public Setup(Context applicationContext) : base(applicationContext)
{
    Crittercism.Init (applicationContext, "YOUR APP ID GOES HERE");
}

Crittercism Xamarin 文档中提供的设置说明假定您将代码放在继承自 Android Activity 的 class 中。对于 MvvmCross,这不适用。您需要将初始化放在 Setup 方法中,而不是如上所示。

版本 2.5 解决了这个问题

https://components.xamarin.com/view/crittercism