{"id":4852,"date":"2014-03-30T16:07:13","date_gmt":"2014-03-30T16:07:13","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/iphone-app-crashes-on-button-click-collection-of-common-programming-errors\/"},"modified":"2014-03-30T16:07:13","modified_gmt":"2014-03-30T16:07:13","slug":"iphone-app-crashes-on-button-click-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/iphone-app-crashes-on-button-click-collection-of-common-programming-errors\/","title":{"rendered":"iPhone App Crashes on button click-Collection of common programming errors"},"content":{"rendered":"<p>You have to find out first what the problem is:<\/p>\n<ul>\n<li>use the Debug build config and are using lldb or gdb<\/li>\n<li>make sure you have a breakpoint on all exceptions<\/li>\n<li>make sure you have the &#8220;Breakpoints&#8221; button top left enabled.<\/li>\n<li>run the app<\/li>\n<\/ul>\n<p>You should break into the debugger. You need to get to a point where the debugger catches the exception.<\/p>\n<p>Then edit your question and tell us what exception you get. I&#8217;m going to guess you&#8217;ll be getting a objc_msgSend() error, which means that some object is trying to message a non-existent or dealloced object. If that turns out to be true, then you can enable &#8220;Zombies&#8221; (which lets all objects stay around) and see if one of those gets messaged.<\/p>\n<p>If nothing seems to help, then what you need to do is start adding NSLog messages to track your app as it comes up (or use breakpoints, your choice). This takes a long time so you might work backwards &#8211; see if your appDelegate application:didFinishLaunchingWithOptions: gets called, and also if you get to the end of it.<\/p>\n<p>Unforunately this type of problem can be take a lot of time to track down. Some object has probably queued a message up for another object on the main queue, so when you get the crash you don&#8217;t get to see who did what when.<\/p>\n<p>Also, with objc_msgSend problems, when the debugger stops you cannot easily see what object was messaged &#8211; but if you turn off the debugger and let the app actually crash, you can find the crash report in the Console app and get more info from that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You have to find out first what the problem is: use the Debug build config and are using lldb or gdb make sure you have a breakpoint on all exceptions make sure you have the &#8220;Breakpoints&#8221; button top left enabled. run the app You should break into the debugger. You need to get to a [&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-4852","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4852","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=4852"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4852\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}