我正在使用Xamarin并试图在iOS模拟器中运行我的某个应用,但我收到此错误:
2015-10-07 12:38:02.715 MolinaCoding1iOS[1550:54337] Unhandled managed exception:
Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil.
It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false. (System.Exception)
我如何真正忽略这种情况?如果我不应该忽视这一点......那我该怎么办?
由于
答案 0 :(得分:2)
我通过运行" Clean"解决了这个问题。在我的项目上(使用Visual Studio)。右键单击您的项目,然后选择" Clean"。之后运行该应用程序。
答案 1 :(得分:1)
您可以通过在使用该类/方法之前添加以下语句来忽略。
ObjCRuntime.Class.ThrowOnInitFailure = false;