{"id":20694,"date":"2018-02-23T15:28:08","date_gmt":"2018-02-23T20:28:08","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=20694"},"modified":"2018-02-23T15:28:08","modified_gmt":"2018-02-23T20:28:08","slug":"debugging-nsnotificationcenter-and-nsrunloop","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/02\/23\/debugging-nsnotificationcenter-and-nsrunloop\/","title":{"rendered":"Debugging NSNotificationCenter and NSRunLoop"},"content":{"rendered":"<p><a href=\"http:\/\/www.timekl.com\/blog\/2018\/02\/22\/debugging-nsnotificationcenter\/\">Tim Ekl<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.timekl.com\/blog\/2018\/02\/22\/debugging-nsnotificationcenter\/\"><p>The <code>debugDescription<\/code> property has been around for quite awhile. Formally first\nappearing as <a href=\"https:\/\/developer.apple.com\/documentation\/objectivec\/1418956-nsobject\/1418703-debugdescription\">a <code>@property<\/code> on NSObject<\/a> in iOS 5 and macOS\n10.8, it came across into Swift as a member of <a href=\"https:\/\/developer.apple.com\/documentation\/swift\/customdebugstringconvertible\">the\n<code>CustomDebugStringConvertible<\/code> protocol<\/a>, and continues to be\nincredibly useful today.<\/p><p>[&#8230;]<\/p><p>I don&rsquo;t remember why I decided to try printing plain old\n<code>NSNotificationCenter.defaultCenter<\/code> in lldb, but I do remember being very\nsurprised at the output. Rather than a plain object class-name-and-pointer pair\nlike most things return, I found a long list of registered notification\nobservers, complete with column headers[&#8230;]<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/rmayoff\/status\/967114255169413120\">Rob Mayoff<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/rmayoff\/status\/967114255169413120\">\n<p><code>NSRunLoop<\/code>\/<code>CFRunLoop<\/code> also provides a very detailed <code>debugDescription<\/code>.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Tim Ekl: The debugDescription property has been around for quite awhile. Formally first appearing as a @property on NSObject in iOS 5 and macOS 10.8, it came across into Swift as a member of the CustomDebugStringConvertible protocol, and continues to be incredibly useful today.[&#8230;]I don&rsquo;t remember why I decided to try printing plain old NSNotificationCenter.defaultCenter [&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":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","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,31,1472,30,1529,71],"class_list":["post-20694","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-debugging","tag-ios","tag-ios-11","tag-mac","tag-macos-10-13","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20694","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=20694"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20694\/revisions"}],"predecessor-version":[{"id":20695,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20694\/revisions\/20695"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=20694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=20694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=20694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}