I am working in MonoTouch and very new to it. I’ve been playing built an app for Windows Phone and I’d like to port it to iOS. Because my app is in Silverlight, that is kind of my point of reference.
- In Silverlight, there is a Application_UnhandledException event. This global event handler empowers someone to handle any error that hasn’t been caught else where in an application. Is there something similar in MonoTouch?
- How should someone create application-wide variables? In Silverlight, I would use App.VariableName. However, I’m not sure if this recommended in MonoTouch.
Thank you!
You can handle unhandled exceptions with this:
Or Application-wide variables, what I usually do is I create a class with the name of my app, which my variables in it, and then I create a sharedInstance object that I use, so I can do something like:
There’s no specific place in the framework for you to put your variables, although some people use the AppDelegate class for it (which seems to be common between iOS obj-c developers). I just prefer to keep it totally separate from UIKit/iOS, so it’s reusable.