{"id":26119,"date":"2019-07-30T14:57:23","date_gmt":"2019-07-30T18:57:23","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=26119"},"modified":"2019-08-01T15:10:33","modified_gmt":"2019-08-01T19:10:33","slug":"debugging-the-responder-chain","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2019\/07\/30\/debugging-the-responder-chain\/","title":{"rendered":"Debugging the Responder Chain"},"content":{"rendered":"<p><a href=\"https:\/\/twitter.com\/jnadeau\/status\/1155325565714354176\">Jeff Nadeau<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/jnadeau\/status\/1155325565714354176\">\n<p>Maybe this will make it easier to see what&rsquo;s up w\/ the responder chain. Pause in the debugger and run<\/p>\n<pre>(lldb) e -- (void)[[[NSClassFromString(@\"NSDebugMenuResponderChainProvider\") alloc] init] toggleResponderChainPanel:nil]<\/pre>\n<p>and then continue. (I reserve the right to break this.)<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/cocoadog\/status\/1155335387218370560\">Andy Lee<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/cocoadog\/status\/1155335387218370560\">\n<p>I usually add my own method to the app delegate that prints the responder chain, starting with the current first responder. Often I add a temporary menu item that calls that method, and assign it a keyboard shortcut.<\/p>\n<\/blockquote>\n\n<p>And here&rsquo;s a link to the <a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/Cocoa\/Conceptual\/EventOverview\/EventArchitecture\/EventArchitecture.html#\/\/apple_ref\/doc\/uid\/10000060i-CH3-SW2\">responder chain documentation<\/a>, since it&rsquo;s now in the archive and not easy to find simply by following links. (You&rsquo;d think it would be linked from the <a href=\"https:\/\/developer.apple.com\/documentation\/appkit\/nsresponder\">NSResponder page<\/a>).<\/p>\n\n<p id=\"debugging-the-responder-chain-update-2019-08-01\">Update (2019-08-01): <a href=\"https:\/\/twitter.com\/fzwob\/status\/1156601282804760576\">Friedrich Markgraf<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/fzwob\/status\/1156601282804760576\">\n<p>If you need to figure out on which instance in the responder chain an action method (like <code>scrollWheel:<\/code>) is actually called, you can use a logging symbolic breakpoint like this[&#8230;]<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Jeff Nadeau: Maybe this will make it easier to see what&rsquo;s up w\/ the responder chain. Pause in the debugger and run (lldb) e -- (void)[[[NSClassFromString(@\"NSDebugMenuResponderChainProvider\") alloc] init] toggleResponderChainPanel:nil] and then continue. (I reserve the right to break this.) Andy Lee: I usually add my own method to the app delegate that prints the responder [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2019-07-30T18:57:26Z","apple_news_api_id":"c77a40c6-5419-484e-9053-215c561f2cef","apple_news_api_modified_at":"2019-08-01T19:10:40Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/Ax3pAxlQZSE6QUyFcVh8s7w","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,56,164,30,1609,71],"class_list":["post-26119","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-debugging","tag-documentation","tag-mac","tag-macos-10-14","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=26119"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26119\/revisions"}],"predecessor-version":[{"id":26138,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26119\/revisions\/26138"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=26119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=26119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=26119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}