iOS black screen and MissingMethodException: Metho

2019-06-03 20:43发布

问题:

I'm starting to create an app using MvvmCross. So far I have an version for Android and for WP running. Unfortunately, creating the app for iOS isn't easy. When running the iOS-app in the simulator, I only get a black screen. In MonoDevelop's Application Output is see the following exception:

2013-01-07 10:42:20.506 BestSellersTouch[319:21e03] mvx: Diagnostic:   0.09 Exception masked MissingMethodException: Method not found: 'System.Type.op_Equality'.
  at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.CreateView (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0 
at Cirrious.MvvmCross.Touch.Views.Presenters.MvxTouchViewPresenter.Show (Cirrious.MvvmCross.Views.MvxShowViewModelRequest request) [0x00000] in <filename unknown>:0 
at Cirrious.MvvmCross.Touch.Views.MvxTouchViewDispatcher+<>c__DisplayClass4.<RequestNavigate>b__3 () [0x00000] in <filename unknown>:0 
at Cirrious.MvvmCross.Touch.Views.MvxTouchUIThreadDispatcher+<>c__DisplayClass1.<InvokeOrBeginInvoke>b__0 () [0x00000] in <filename unknown>:0 
2013-01-07 10:42:20.508 BestSellersTouch[319:21e03] Application windows are expected to have a root view controller at the end of application launch

Is this error causing a black screen?

回答1:

References to System.Type.op_Equality only exists when an assembly is compiled against mscorlib.dll 4.0 (and later).

Current version of MonoTouch does not support 4.0 (and that member is not part of the assembly) which result in this exception at runtime.

The solution, until MonoTouch supports 4.0 (this spring) is to rebuild the assembly and make sure it referenes the mscorlib.dll that ships with MonoTouch.

The fact that this exception is thrown while presenting a view is likely the reason of your black screen (nothing got executed to show anything on it).