AppIcon



App icon ios

Last week I received a message from Fons Sonnemans who is porting his awesome Minesweeper 10 game from UWP to Uno Platform. He said he was facing a weird issue with his app on iOS, where the app icon was not showing up after deploying. He also posted a screenshot of the issue on Twitter:

This fixed the problem in my case. After updating 'Command Line Tools' to 'Xcode 10.0', the 'App Icon Source' setting in the project was deselected. I selected the 'AppIcon' of the Asset Catalog again and the app icon started to appear. I'm using Xcode 10 beta 2. – Taka Jun 24 '18 at 3:54. Dim appIcon As Icon Dim shinfo As New SHFILEINFO Dim hSuccess As IntPtr = SHGetFileInfo( mainAssembly.Location, 0shinfo, Marshal.SizeOf(shinfo)SHGFIICON Or SHGFILARGEICON). Get free App icons in iOS, Material, Windows and other design styles for web, mobile, and graphic design projects. These free images are pixel perfect to fit your design and available in both PNG and vector. Download icons in all formats or edit them for your designs. Current Page: Home Shop Art Contact Login Account. Shop now Open Menu Close Menu. Current Page: Home.

I can't get the Icon of my iOS (#Uno/#Xamarin) app correct. It shows the default icon instead of my AppIcons. #help#dtapic.twitter.com/6XiuAJLmQe

— Fons Sonnemans 🇳🇱 (@fonssonnemans) May 7, 2020

I originally thought it could be caused by a low iOS version target (which has caused me issues before in other things), but surprisingly it was not that. In the Visual Studio asset editor and Info.plist all seemed perfectly fine. Even the .csproj contained all the <ImageAsset> references:

<ItemGroup>
<ImageAssetInclude='Media.xcassetsAppIcon.appiconsetiPad-76×76%402x.png'>
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>

Even then, the Simulator still kept showing the same old default iOS app icon. I asked Fons if he would be willing to provide me access to the repo so that I could run it locally on my Mac, to check if it is not some kind of caching issue – but that wasn’t the case either and the icon was still missing.

AppIcon

Let’s solve this mystery together!

Suspicious build output

After a while searching the internet I came onto this Stack Overflow answer by mamcx for a similar problem (emphasis mine):

Did you check the build warnings when you compiled the app. You should see a bunch of warnings about missing .png files in the AppIcon image set.

Unlike Xcode, VS requires a reference to each iOS asset .png file in the .csproj file as well as the Assets.xcassets Contents.json file. It’s redundant; but it’s just how VS works.

At first glance, this seemed to lead nowhere, as I previously confirmed the <ImageAsset> references were, in fact, present in the .csproj file. But out of curiosity I made a search for .png in the Build Output window and found 18 messages like this:

The file “iphone_60x60@2x.png” for the image set “AppIcons” does not exist.

Why would the file not exist? It is clearly visible in the asset editor and it is in the .csproj – something really funky is going on here!

Include those files!

If Visual Studio thinks the image files are missing, let’s include them “by force”! In Solution Explorer, I clicked the Show All Files button on the top. There I saw the Media.xcassets folder and right-clicked it and selected Include In Project. What I got were now essentially two copies of the same images in the project – once as part as the Asset Catalogs and once in the Media.xcassets folder:

I thought this can’t change anything, but went ahead and tried to run the app again, just to be sure. To my surprise – it worked! The app icon was now there, smiling at me from the iPad’s home screen:

But… why?

It was great it now worked, but why? Luckily, the answer is really close now.

I opened the .csproj file to see what is in there. At first glance it seemed Visual Studio just included the same files twice, just without the <Visible>false</Visible> modifier, so the new copy was actually visible in the Solution Explorer.

<ItemGroup>
<ImageAssetInclude='Media.xcassetsAppIcon.appiconsetipad-76×76%402x.png' />
</ItemGroup>

Looks the same… but what if we look at the two side by side?

<ItemGroup>
<ImageAssetInclude='Media.xcassetsAppIcon.appiconsetiPad-76×76%402x.png'>
<Visible>false</Visible>
</ImageAsset>
</ItemGroup>

Aha! ipad vs iPad! Could it be the uppercase? The Contents.json file referenced the lowercase versions of the image files, but .csproj originally used the one with uppercase “P” in the filenames.

This would normally not be a problem, as Windows is case insensitive, but macOS/iOS is not! It turns out that while copying the project files to the output, Visual Studio uses the casing specified in the .csproj file, not the one which the files had originally. I confirmed this by going into the build cache folder on Mac (/User/Library/Caches/Xamarin/mtbs/builds):

Appiconz

I deleted the build cache, reverted all changes, and then modified the .csproj file to use lowercase versions of the file names in <ImageAsset> elements. Rebuilt and deployed and app icon was there again – but, as the masked magician would say, now we know the secrets!

Mystery solved!

The main takeaway I have from this puzzle is that file casing matters when building cross-platform apps, especially because both Android and iOS are Unix-like and are case sensitive. Also, I will try to remember to read the build output warning messages more closely, as they were telling the truth all along!

Related

App Icon

Beautiful app icons are an important part of the user experience on all Apple platforms. A unique, memorable icon evokes your app and can help people recognize it at a glance on the desktop, in Finder, and in the Dock. Polished, expressive icons can also hint at an app’s personality and even its overall level of quality.

In macOS 11, app icons share a common set of visual attributes, including the rounded-rectangle shape, front-facing perspective, level position, and uniform drop shadow. Rooted in the macOS 11 design language, these attributes showcase the lifelike rendering style people expect in macOS while presenting a harmonious user experience. To download templates that specify the correct shape and drop shadow, see Apple Design Resources.

IMPORTANT When you update your app for macOS 11, use your new app icon design to replace the icon you designed for earlier versions. You can’t include two different app icons for one app, and the macOS 11 app icon style looks fine on a Mac running Catalina or earlier.

Design a beautiful icon that clearly represents your app. Combine an engaging design with an artistic interpretation of your app’s purpose that people can instantly understand.

Embrace simplicity. Find a concept or element that captures the essence of your app and express it in a simple, unique way, adding details only when doing so enhances meaning. Too many details can be hard to discern and can make the icon appear muddy, especially at smaller sizes.

Establish a single focus point. A single, centered point of interest captures the user’s attention and helps them recognize your app at a glance. Presenting multiple focus points can obscure the icon’s message.

To give people a familiar and consistent experience, prefer a design that works well across multiple platforms. If your app runs on other platforms, use a similar image for all app icons while rendering them in the style that’s appropriate for each platform. For example, in iOS and watchOS, the Mail app icon depicts the white envelope in a streamlined, graphical style; in macOS 11, the envelope includes depth and detail that communicate a realistic weight and texture.

macOS 11

Consider depicting a familiar tool to communicate what people use your app to do. To give context to your app’s purpose, you can use the icon background to portray the tool’s environment or the items it affects. For example, the TextEdit icon pairs a mechanical pencil with a sheet of lined paper to suggest a utilitarian writing experience. After you create a detailed, realistic image of a tool, it often works well to let it float just above the background and extend slightly past the icon boundaries. If you do this, make sure the tool remains visually unified with the background and doesn’t overwhelm the rounded-rectangle shape.

Make real objects look real. If you depict real objects in your app icon, make them look like they’re made of physical materials and have actual mass. Replicate the characteristics of substances like fabric, glass, paper, and metal to convey an object’s weight and feel. For example, the Xcode app icon features a hammer that looks like it has a steel head and polymer grip.

App Icon Generator

If text is essential for communicating your app’s purpose, consider creating a graphic abstraction of it. Actual text in an icon can be difficult to read and doesn’t support accessibility or localization. To give the impression of text without implying that people should zoom in to read it, you can create a graphic texture that suggests it.

To depict photos or parts of your app’s UI, create idealized images that emphasize the features you want people to notice. Photos are often full of details that obscure the main content when viewed at small sizes. If you want to use a photo in your icon, pick one with strongly contrasting values that make the main subject stand out. Remove unimportant details that make primary lines and shapes fuzzy or indistinct. If your app has a UI that people recognize, avoid simply replicating standard UI elements or using a screenshot in your icon. Instead, consider designing a graphic that echoes the UI and expresses the personality of your app.

Don’t use replicas of Apple hardware products. Apple products are copyrighted and can’t be reproduced in your icons or images. Avoid displaying replicas of devices, because hardware designs tend to change frequently and can make your icon look dated.

Use the drop shadow in the icon-design template. The template includes the system-defined drop shadow that helps your app icon coordinate with other macOS 11 icons.

App Icon Cache

Consider using interior shadows and highlights to add definition and realism. For example, the Mail app icon uses both shadows and highlights to give the envelope authenticity and to suggest that the flap is slightly open. In icons that include a tool that floats above a background — such as TextEdit or Xcode — interior shadows can strengthen the perception of depth and make the tool look real. Shadows and highlights should suggest a light source that faces the icon, positioned just above center and tilted slightly downward.

Avoid defining contours that suggest a shape other than a rounded rectangle. In rare cases, you might want to fine-tune the basic app icon shape, but doing so risks creating an icon that looks like it doesn’t belong in macOS 11. If you must alter the shape, prefer subtle adjustments that continue to express a rounded rectangle silhouette.

Consider adding a slight glow just inside the edges of your icon. If your app icon includes a dark reflective surface, like glass or metal, add an inner glow to make the icon stand out and prevent it from appearing to dissolve into dark backgrounds.

Keep primary content within the icon grid bounding box; keep all content within the outer bounding box. If an icon’s primary content extends beyond the icon grid bounding box, it tends to look out of place. If you overlay a tool on your icon, it works well to align the tool’s top edge with the outer bounding box and its bottom edge with the inner bounding box, as shown below.

In addition to the bounding boxes and suggested tool placement, the icon design template provides a grid to help you position items within an icon. You can also use the icon grid to ensure that centered inner elements like circles use a size that’s consistent with other icons in the system.

App Icons

App Icon Attributes

All app icons should use the following specifications.

AttributeValue
FormatPNG
Color spacesRGB (color) or Gray Gamma 2.2 (grayscale)
LayersFlattened with transparency as appropriate
Resolution@1x and @2x (see Image Size and Resolution)
ShapeSquare with no rounded corners

Don’t provide app icons in ICNS or JPEG format. The ICNS format doesn’t support features like wide color gamut or deliver the performance and efficiency you get when you use asset catalogs. JPEG doesn’t support transparency through alpha channels, and its compression can blur or distort an icon’s images. For best results, add deinterlaced PNG files to the app icon fields of your Xcode project’s asset catalog.

App Icon Sizes

Your app icon is displayed in many places, including in Finder, the Dock, Launchpad, and the App Store. To ensure that your app icon looks great everywhere people see it, provide it in the following sizes:

  • 512x512 pt (512x512 px @1x, 1024x1024 px @2x)
  • 256x256 pt (256x256 px @1x, 512x512 px @2x)
  • 128x128 pt (128x128 px @1x, 256x256 px @2x)
  • 32x32 pt (32x32 px @1x, 64x64 px @2x)
  • 16x16 pt (16x16 px @1x, 32x32 px @2x)

Maintain visual consistency in all icon sizes. As icon size decreases, fine details become muddy and hard to distinguish. At the smallest sizes, it’s important to remove unnecessary features and exaggerate primary features to help the content remain clear. As you simplify icons that are visually smaller, don’t let them appear drastically different from their larger counterparts. Strive to make subtle variations that ensure the icon remains visually consistent when displayed in different environments. For example, if people drag your icon between displays with different resolutions, the icon’s appearance shouldn’t suddenly change.

The 512x512 pt Safari app icon (on the left) uses a circle of tick marks to indicate degrees; the 16x16 pt version of the icon (on the right) doesn’t include this detail.