Monotouch Global Exception handling

后端 未结 2 1191
刺人心
刺人心 2021-02-19 08:39

I am having a nasty bug show up in the wild, and I can\'t put my finger on it. Is there a way to have a Global Try/Catch block, or a way to handle any exception that is unhanded

2条回答
  •  不知归路
    2021-02-19 09:03

    You can wrap UIApplication.Main (args) in a try {} catch {} but you will not be able to show a UIAlertView at that point, since we've unwound the entire stack including all the UI. What you could do is log the exception to a crash file in the Documents folder of your application bundle, and show that on the next launch or upload it to a web service.

    The Exceptioneer guys were working on MonoTouch support as well, which might be worth looking into.

提交回复
热议问题