{"id":921,"date":"2012-12-02T12:24:47","date_gmt":"2012-12-02T11:24:47","guid":{"rendered":"http:\/\/www.malcolmhardie.com\/weblogs\/angus\/?p=921"},"modified":"2025-02-01T03:04:14","modified_gmt":"2025-02-01T03:04:14","slug":"using-nsdocktile-for-debug-info","status":"publish","type":"post","link":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/2012\/12\/02\/using-nsdocktile-for-debug-info\/","title":{"rendered":"Using NSDockTile for debug info"},"content":{"rendered":"<p>Often when I&#8217;m working on an app or something I end up running several different versions of it in a short period of time. There&#8217;s usually some bug that I&#8217;m trying to fix and I want to make sure that the bug occurs in the old version and doesn&#8217;t occur in the new version.<\/p>\n<p>Sometimes though I get confused which version I&#8217;m running. Is the app in the dock the old version, or the new version or something else?<\/p>\n<p>So today I had an idea: Why not put the version number on the dock tile?<\/p>\n<p>Here&#8217;s the code to do it:<\/p>\n<pre style=\"width: 100%; text-wrap: none; font-size: x-small;\">if (DEBUG) {\n  id badgeText = [NSString stringWithFormat:@\"D-%@\",[[[NSBundle mainBundle] infoDictionary] valueForKey:@\"CFBundleVersion\"]];\n  [[NSApp dockTile] setBadgeLabel:badgeText];\n}<\/pre>\n<p>This assumes that you&#8217;ve got DEBUG defined somehow and that you have an infoDictionary with the relevant keys and values set.<\/p>\n<p>And here&#8217;s what it looks like in the dock:<\/p>\n<p><a href=\"https:\/\/oak.malcolmhardie.com\/weblogs\/angus\/wp-content\/uploads\/2012\/12\/DockTileVersion.png\"><img loading=\"lazy\" decoding=\"async\" title=\"DockTileVersion\" src=\"https:\/\/oak.malcolmhardie.com\/weblogs\/angus\/wp-content\/uploads\/2012\/12\/DockTileVersion.png\" alt=\"\" width=\"206\" height=\"126\" \/><\/a><\/p>\n<p>Regular version on the left, development version on the right.<\/p>\n<p>I&#8217;m not sure how useful this will actually be, but it seemed a handy trick for development.<\/p>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Often when I&#8217;m working on an app or something I end up running several different versions of it in a short period of time. There&#8217;s usually some bug that I&#8217;m trying to fix and I want to make sure that the bug occurs in the old version and doesn&#8217;t occur in the new version. Sometimes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12,14],"tags":[],"class_list":["post-921","post","type-post","status-publish","format-standard","hentry","category-macintosh","category-sqleditor","category-writing-software"],"_links":{"self":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/comments?post=921"}],"version-history":[{"count":1,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/921\/revisions"}],"predecessor-version":[{"id":1312,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/posts\/921\/revisions\/1312"}],"wp:attachment":[{"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/media?parent=921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/categories?post=921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.malcolmhardie.com\/weblogs\/angus\/wp-json\/wp\/v2\/tags?post=921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}