{"id":179,"date":"2014-01-26T11:57:26","date_gmt":"2014-01-26T17:57:26","guid":{"rendered":"http:\/\/dev.iachieved.it\/iachievedit\/?p=179"},"modified":"2014-12-10T20:19:44","modified_gmt":"2014-12-11T02:19:44","slug":"managing-ios-application-icons","status":"publish","type":"post","link":"https:\/\/dev.iachieved.it\/iachievedit\/managing-ios-application-icons\/","title":{"rendered":"Managing iOS Application Icons"},"content":{"rendered":"<p><i><br \/>\nEditors Note:  This article was originally published on January 26, 2014.  The included automator script needs to be expanded to include icon dimensions for the latest lineup for iPhones, but you can easily do that with OS X Automator.<\/p>\n<p>You might be interested in checking out our new post on quickly creating <a href=\"http:\/\/dev.iachieved.it\/iachievedit\/quickly-creating-apple-watch-icons\/\">Apple Watch<\/a> icons!<br \/>\n<\/i><\/p>\n<p>I will admit that I&#8217;m a terrible graphic artist.  Any icons, logos, graphics, etc. coming out of iAchieved.it LLC most certainly did not come from me.  Yet, I do have to deal with taking the artwork created for us and importing it into our iOS applications, and although it has gotten easier, Apple hasn&#8217;t yet made it trouble-free.  Trouble-free in my opinion would be supplying one file (the original master) to XCode and letting it take care of the rest.  But, we aren&#8217;t there yet so let&#8217;s look at the next best thing.<\/p>\n<p>In this blog post I&#8217;ll look at how to take your application icon and create all the right files to import into your XCode project.  Now, there will be a few assumptions.  They are:<\/p>\n<ul>\n<li>you have an original 1024&#215;1024 PNG file of your application icon\n<li>you are using XCode 5 and are ready to explore the joys of <code>Images.xcassets<\/code>\n<li>you&#8217;ve at least heard of OS X <a href=\"http:\/\/en.wikipedia.org\/wiki\/Automator_(software)\">Automator<\/a>\n<\/ul>\n<p>If you don&#8217;t have a 1024&#215;1024 PNG of your application icon, I suggest you go get one.  You will at least need it to create your application entry in <a href=\"https:\/\/itunesconnect.apple.com\/\">iTunesConnect<\/a>.  Every other year Apple seems to be raising the resolution that the AppStore icon must be in.  Suffice it to say, this year its 1024&#215;1024.<\/p>\n<p>As the iPhone and iOS operating system have evolved over the years, so have the icon sizes required in your application bundle.  On a &#8220;non-retina&#8221; iPhone (such as the 3GS), you could get by with supplying a 57&#215;57 PNG and be done with it.  Unfortunately on an iPhone 4 (retina display), the 57&#215;57 PNG looked like, well, less than crisp.  So, you had to begin bundling a 114&#215;114 (note that 114 is 57 times 2) icon with your application.  If you read up on <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/iphone\/conceptual\/iphoneosprogrammingguide\/App-RelatedResources\/App-RelatedResources.html#\/\/apple_ref\/doc\/uid\/TP40007072-CH6-SW1\">Apple&#8217;s documentation<\/a> you could supply on a single icon labeled <code>@2x<\/code> that was 114&#215;114 and the OS would display the image correctly regardless of the phone.<\/p>\n<p>With iOS 7 and XCode 5 it gets even crazier.  You can supply all of the following dimensions for your application icon:<\/p>\n<ul>\n<li>for an iOS 7 launchpad icon, supply a 60pt icon in 2x resolution (that is 120&#215;120)\n<li>for an iOS 5 or 6 launchpad icon, supply a 57pt icon in 2x resolution (that is 114&#215;114)\n<li>for an iOS 7 Spotlight icon (the miniature icon that displays when you search for an application), supply a 40pt icon at 2x resolution (that is, 80&#215;80)\n<li>for an iOS 5 or 6 Spotlight icon, supply a 29pt icon at 2x resolution (58&#215;58)\n<li>for an iOS 5, 6, or 7 Settings icon, supply a 29pt icon at 2x resolution (58&#215;58)\n<\/ul>\n<p>And for any phone that has a target earlier than iOS 7 you have to supply 1x versions for the Spotlight and Launchpad icons, 29pt and 57pt, respectively.  Yikes!<\/p>\n<p>I don&#8217;t know about you, but I get tired of resizing icons and all that.  So, before we get to using <code>Images.xcassets<\/code>, let&#8217;s take a look at an Automator script that we can add to our Mac as a Service.  This will allow us to take our source application icon (the one at 1024&#215;1024 resolution), and generate all of the little icons we need.  Then its drag-and-drop into XCode and done.  <\/p>\n<p>Enter Automator, and better, enter Automator Services.  We&#8217;ll save how to create Automator scripts (actually, I think they are called &#8220;workflows&#8221;) for a later date.  For now, we&#8217;ll just give you our Automator Service Workflow <b>CreateXCodeIcons<\/b>.  To get it, simply download <a href=\"http:\/\/dev.iachieved.it\/downloads\/CreateXCodeIcons.zip\">CreateXCodeIcons.zip<\/a>, unzip, and then right-click on the <b>CreateXCodeIcons<\/b> file.  The application is currently unsigned, so you will get a prompt requesting whether or not to open a file from an unknown developer.  Click Open.<\/p>\n<p>A prompt that looks like this will ask whether or not you want to install the <b>CreateXCodeIcons<\/b> service. <\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/want_to_install_service.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/want_to_install_service.png\" alt=\"want_to_install_service\" width=\"514\" height=\"184\" class=\"alignnone size-full wp-image-194\" \/><\/a><\/p>\n<p>Click Install, and now you will have a new menu item in your Finder called <b>CreateXCodeIcons<\/b>.<\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/workflow_installed.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/workflow_installed.png\" alt=\"workflow_installed\" width=\"514\" height=\"159\" class=\"alignnone size-full wp-image-195\" \/><\/a><\/p>\n<p>Okay, now take your 1024&#215;1024 icon (which in our screenshots we&#8217;ll call <code>icon.png<\/code>), place it in its own folder (this is important to keep everything organized, otherwise the Service will scatter icons in whatever location you had your original in) and right click on it, scroll down to <code>Services<\/code> and select <code>CreateXCodeIcons<\/code>.  The automator service will begin creating copies of the original and resizing them to the dimensions that will be loaded into your XCode project.  <\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/ding_finder_icons.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/ding_finder_icons.png\" alt=\"ding_finder_icons\" width=\"722\" height=\"427\" class=\"alignnone size-full wp-image-183\" \/><\/a><\/p>\n<p>Notice the original <code>icon.png<\/code> followed by<\/p>\n<ul>\n<li><code>60pt@2x.png<\/code>\n<li><code>57pt@2x.png<\/code>\n<\/ul>\n<p>and so on.  These are the files that you will drag into the XCode <code>Images.xcassets<\/code> folder to provide icons for your application.  The names we created are arbitrary, when you add them to your XCode project they will actually be copied and embedded into the project.  But, there is a method to our madness.  The names line up with where you will place them on the AppIcon canvas.  For example, the <code>60pt@2x.png<\/code> icon would be dragged to the location that indicates &#8220;2x 60pt&#8221;, as shown below:<\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/ios760pt.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/ios760pt.png\" alt=\"ios760pt\" width=\"123\" height=\"140\" class=\"alignnone size-full wp-image-185\" \/><\/a><\/p>\n<h2>Adding Icon Assets to Your XCode Project<\/h2>\n<p>Now that we can easily create all of the icons we need for our application, let&#8217;s look at adding them and some of the nuances involved.  For a quick start, download our <code>ding<\/code> project from <a href=\"https:\/\/github.com\/iachievedit\/ding\">GitHub<\/a>.  Select the <b>master<\/b> branch which does not contain any app icon assets.<\/p>\n<p>Open the XCode project, select the <code>ding<\/code> target, and go to the <b>General<\/b> tab of the target.  Scroll down to the section that says App Icons and notice it probably looks like this:<\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/asset_catalog_panel.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/asset_catalog_panel.png\" alt=\"asset_catalog_panel\" width=\"651\" height=\"100\" class=\"alignnone size-full wp-image-187\" \/><\/a><\/p>\n<p>To get started with using an asset catalog for your app icons first select the text that says &#8220;Don&#8217;t use asset catalogs&#8221; and then you must click on the button that says &#8220;Use Asset Catalog&#8221;.  A dialog indicating that there currently isn&#8217;t an asset catalog will pop up, and you will want to click <b>Migrate<\/b>.<\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/migrate_app_icons.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/migrate_app_icons.png\" alt=\"migrate_app_icons\" width=\"428\" height=\"141\" class=\"alignnone size-full wp-image-188\" \/><\/a><\/p>\n<p>You will now see a new folder in your project named <code>Images.xcassets<\/code>.<\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/new_images_xcassets.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/new_images_xcassets.png\" alt=\"new_images_xcassets\" width=\"261\" height=\"257\" class=\"alignnone size-full wp-image-189\" \/><\/a><\/p>\n<p>Once you&#8217;ve added the <code>Images.xcassets<\/code> folder you will want to add a LaunchImage as well, otherwise you will receive the error <code>Asset Catalog Compiler Error:  None of the input catalogs contained a matching launch image set named \"LaunchImage\".<\/code>.  This is simple to fix:  click on the <code>Images.xcassets<\/code> folder and then beneath the list (of one) that contains <code>AppIcon<\/code>, click the plus sign and choose <b>New Launch Image<\/b>.  The asset catalog compiler error will go away.<\/p>\n<p>You can build the application at this point, you will just get the default iOS &#8220;pencil-sketch&#8221; icon.  Let&#8217;s add some icons.  Take the <code>60pt@2x.png<\/code> icon that was generated and drag-and-drop onto the <b>AppIcon<\/b> canvas in the spot for <b>iPhone App iOS 7 60pt<\/b>.  If your target is for iOS 7.0 and higher you can stop right here. This is the only icon you actually are <i>required<\/i> to supply, but since we already generated the Settings and Spotlight icons, you might as well add them, they are highly recommended in the <a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/userexperience\/conceptual\/mobilehig\/IconMatrix.html\n\">Human Interface Guide<\/a> from Apple.<\/p>\n<h2>iOS 6 and Earlier<\/h2>\n<p>By default our <code>ding<\/code> target is set to deploy to iOS 7.0 and higher.  It turns out that iOS 7 is available only for iPhone 4 and up, and those models do not use a 57&#215;57 &#8220;low-resolution&#8221; icon.  However, if you want to target the iOS 6, that OS runs on the iPhone 3GS which <i>does<\/i> use the lower resolution icons.  To see what happens when you don&#8217;t provide all of the required icon assets for your Deployment Target, go back to the <b>Deployment Info<\/b> panel of the <code>ding<\/code> target application and change <b>7.0<\/b> to say, <b>6.1<\/b>.  XCode won&#8217;t recognize right away that you haven&#8217;t included all of the proper icons, but if you then run the application (or build it), you will see a warning along the lines of <code>A 57x57 app icon is required for iPhone apps targeting releases of iOS prior to 7.0<\/code>, as well as a warning similar indicating that a <code>@2x<\/code> icon is required.  To fix, drag-and-drop the <code>57pt@2x.png<\/code> and <code>57pt.png<\/code> icons onto the <b>AppIcons<\/b> canvas and XCode will automatically create entries for the devices\/targets they support.  The final canvas should have these entries:<\/p>\n<p><a href=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/final_icons.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dev.iachieved.it\/iachievedit\/wp-content\/uploads\/2014\/01\/final_icons.png\" alt=\"final_icons\" width=\"322\" height=\"169\" class=\"alignnone size-full wp-image-197\" \/><\/a><\/p>\n<p>Remember, Apple recommends you supply icons for Settings and Spotlight, and the <b>CreateXCodeIcons<\/b> service from above creates the right icons for these too!<\/p>\n<h2>Conclusion<\/h2>\n<p>Managing all of the various dimensions of application icons required for an iPhone application can be a real pain.  Fortunately, we can automate and streamline a lot of the drudgery.  Using the OS X service <a href=\"\">CreateXCodeIcons<\/a> and the <b>Asset Catalog<\/b> feature of XCode 5 projects, app icon management overhead can be kept to a minimum.<\/p>\n<p>The final <code>ding<\/code> project, with application icons added, can be viewed by switching the <a href=\"\">GitHub ding project<\/a> to the <b>with_app_icons<\/b> branch.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Editors Note: This article was originally published on January 26, 2014. The included automator script needs to be expanded to include icon dimensions for the latest lineup for iPhones, but you can easily do that with OS X Automator. You might be interested in checking out our new post on quickly creating Apple Watch icons! [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-179","post","type-post","status-publish","format-standard","hentry","category-xcodetips"],"_links":{"self":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/179"}],"collection":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":11,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"predecessor-version":[{"id":1138,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/179\/revisions\/1138"}],"wp:attachment":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}