Adding an Action Extension Icon to a Xamarin iOS App

get_the_author_meta('user_nicename')

Action extensions are a great way to more deeply integrate your app with iOS. While building these extensions is well documented, getting an icon to show up is not, particularly in the Xamarin iOS arena. Below along the bottom row is an example of some built in extensions that work with Safari:

Note that the extensions are monochromatic. Your extension icon should have a transparent background, or else your icon will show up as all dark gray. Below you can see the icon that I used for the extension:

This is basically where I got stuck initially setting up the extension icon. How many icons are needed at what sizes? How do the extension icons get set? An asset catalog? Some other way? Do they go in the extension project or the parent app project? Here’s what I found:

For modern iOS devices, action extensions require @2x and @3x 60 slot icons – 120×120 and 180×180.

Most information I found online pointed to using an asset catalog for these icons. However, I was not able to get this to work within my Xamarin project. What did work was adding these icons to the resources folder of the extension project (I named them Icon-60@2x and Icon-60@3x), and then adding the following CFBundleIconFiles key to the extension’s info.plist:

<key>CFBundleIconFiles</key>
<array>
<string>Icon-60@2x</string>
<string>Icon-60@3x</string>
</array>

Just like that – the extension’s icon started showing up!

Hopefully this helps anyone else working on Xamarin iOS extension project to set up your extension’s icon.