{"id":4350,"date":"2014-03-30T09:59:00","date_gmt":"2014-03-30T09:59:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/objective-c-can-not-catch-exception-from-calling-super-method-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:59:00","modified_gmt":"2014-03-30T09:59:00","slug":"objective-c-can-not-catch-exception-from-calling-super-method-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/objective-c-can-not-catch-exception-from-calling-super-method-collection-of-common-programming-errors\/","title":{"rendered":"Objective c can not catch exception from calling super method-Collection of common programming errors"},"content":{"rendered":"<p>I am calling a super method from my subclass. But sometimes the object of the superclass (UIWindow) is nil so it will fail. I try to catch the exception but it doesn\u00b4t work. The app still crashes. Can anyone tell me why and how I can fix this?<\/p>\n<pre><code>- (void)sendEvent:(UIEvent *)event;  \n{\n     @try {\n         [super sendEvent:event];\n     }\n     @catch(NSException *e) {\n         NSLog(@\"%@\",e);\n         return;\n}\n<\/code><\/pre>\n<p>Thanks a lot<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am calling a super method from my subclass. But sometimes the object of the superclass (UIWindow) is nil so it will fail. I try to catch the exception but it doesn\u00b4t work. The app still crashes. Can anyone tell me why and how I can fix this? &#8211; (void)sendEvent:(UIEvent *)event; { @try { [super [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4350","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4350"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4350\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}