Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false?

I'm using Xamarin and trying to run one of my apps in the iOS simulator but I am getting this error:

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)

How do I actually ignore this condition? If I should not ignore this...then what should I do?

Thanks

like image 871
stepheaw Avatar asked Oct 07 '15 18:10

stepheaw


2 Answers

I got this problem solved by running "Clean" on my project (using Visual Studio). Right Click your project and select "Clean". Run the application afterwards.

like image 57
Ton Snoei Avatar answered Sep 19 '22 04:09

Ton Snoei


You can ignore by adding the below statement just before you use that class/ method.

ObjCRuntime.Class.ThrowOnInitFailure = false;
like image 33
Anand Avatar answered Sep 23 '22 04:09

Anand