{"id":191,"date":"2008-12-26T19:04:21","date_gmt":"2008-12-27T00:04:21","guid":{"rendered":"http:\/\/vgable.com\/blog\/2008\/12\/26\/always-update-the-view-from-the-main-thread\/"},"modified":"2008-12-26T19:04:23","modified_gmt":"2008-12-27T00:04:23","slug":"always-update-the-view-from-the-main-thread","status":"publish","type":"post","link":"https:\/\/vgable.com\/blog\/2008\/12\/26\/always-update-the-view-from-the-main-thread\/","title":{"rendered":"Always Update the View From the Main Thread"},"content":{"rendered":"<p>I wish I&#8217;d read this years ago:<\/p>\n<blockquote><p> <strong>AppKit, the GUI framework, is not thread safe. In order for things to work properly, you (almost) always need to update GUI classes from the main thread<\/strong><\/p><\/blockquote>\n<p>&#8212;<a href=\"http:\/\/www.dribin.org\/dave\/blog\/archives\/2008\/05\/22\/invoke_on_main_thread\/\">Dave Dribin<\/a> (slightly edited)<\/p>\n<p>I&#8217;ve <a href=\"http:\/\/vgable.com\/blog\/2008\/05\/14\/nsalert-sheets-threads-inexplicable-bugs\/\">run into UI + threading problem before<\/a>, but I&#8217;d just never seen this limitation of AppKit spelled out.<\/p>\n<p><a href=\"http:\/\/www.dribin.org\/dave\/blog\/archives\/2008\/05\/22\/invoke_on_main_thread\/\">Dave&#8217;s article explains how to call code on the main thread<\/a> better then I can.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wish I&#8217;d read this years ago: AppKit, the GUI framework, is not thread safe. In order for things to work properly, you (almost) always need to update GUI classes from the main thread &#8212;Dave Dribin (slightly edited) I&#8217;ve run into UI + threading problem before, but I&#8217;d just never seen this limitation of AppKit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53,18,6,38,3,5,4,24],"tags":[211,259,29],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-announcement","category-bug-bite","category-cocoa","category-interface-builder","category-macosx","category-objective-c","category-programming","category-quotes","tag-appkit","tag-multi-core","tag-threads"],"_links":{"self":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":0,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"wp:attachment":[{"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vgable.com\/blog\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}