iosios-extensions

Unable to set an action extension icon, grey icon instead


I've tried to set my action extension icon by following tutorials available online. The steps I've followed:

  1. Migrate the application asset catalog to the extension
  2. Putting all my grey icons in the asset
  3. Checking that Assets.xcassetsis in the copy bundle resources list of the extension
  4. Run the app and check the extension

But it only renders a grey block: grey block and other icons

What could be wrong?


Solution

  • For Action Extension Icon, any color data in the image itself is ignored. as stated in Apple Docs

    The alpha channel of the image is used as a mask to generate the final image that is presented to the user. Any color data in the image itself is ignored.

    To fix this issue, follow these 4 step

    1. First remove alpha channel from your icon using tinypng.com or alphaChannelRemover app
    2. added a new Asset Catalog set to my extension by right click -> New File -> under IOS choose “Resource” -> Asset Catalog

    3. In that Asset Catalog, I added an new AppIcon, using the + menu at the bottom. Note the name is: AppIcon, then added your removed alpha icons to the new AppIcon.

    4. Then under Targets, I selected my extension, then under Build Settings under Asset Catalog Compiler - Options, I added AppIcon to the Asset Catalog App Icon Set Name field.

    enter image description here