How do you specify an action extension icon?

All types of extensions use the application icon, with the exception of the action extension. Apple documentation says the following:

On iOS, the Action custom extension uses the template version of its containing the application icon that you must provide.

However, it does not say how you should provide the icon. It says:

For information on how to add an icon to an application extension, see Creating an asset catalog and adding an application icon or launching a Set image.

But the links to “Creating an asset catalog” and “Adding an application icon” are links to how to add an icon for an application, they do not contain a section on how to add an icon specifically for an extension action.

The extension target does not contain the application icon icon in the general Xcode settings (unlike the application), therefore its icon should presumably be added through the asset catalog. However, I added an application icon image installed in the extension resources directory, but the extension icon still does not appear.

How do I add an icon to expand an action? And if it is through its asset catalog, then why doesn’t it work when I added an icon image installed in the asset catalog?

UPDATE: I found a tutorial for action extensions ( http://code.tutsplus.com/tutorials/ios-8-how-to-build-a-simple-action-extension--cms-22794 ) that says that icon can be added through target application icons and launching Images on the General tab. But the extension of the action does not have this !! (Xcode 8.6)

+5
source share
5 answers

To make it work is not enough to add assets to the asset catalog - it is additionally necessary to set the resources catalog compiler options in the "Assembly parameters" section of the extension to indicate the name of the application icon installed in the Assets catalog:

enter image description here

+4
source
  • Click the group containing the extension files → New file ...
  • Find and select the iOS / Resource / Asset Catalog
  • Select the newly created asset catalog, press the + button, and select "Application Icons" and "Launch Images"> "New iOS Application Icon" enter image description here
  • Drop the icons in the placeholder at 60 points. You will need the icons 120x120 (aka @ 2x) and 180x180px (aka @ 3x)

enter image description here

  1. Select the Target extension and go to the "Settings" section, find the "Asset catalog application icon set identifier" and enter the name of the asset there.

enter image description here

Create and run the extension.

+8
source

The documentation for action extension icons is not particularly useful - try this answer , which provides a processed example, or this answer , combined with a discussion, continued in the chat.

For the icon itself, the current manual is as follows:

Use the template image for the action extension icon. The template image uses a mask to create the icon. Use black and white with appropriate transparency and smoothing and do not turn on the shadow. Template images should be centered in an area of ​​about 70 pixels by 70 pixels.

+1
source

We need a monochrome icon for the Extension application, which has exactly the same size and type as in Appicon (only the name and type of the icon are different). First, we need to include assets in the expansion target.

Step 1: - to add assets, click on the expansion scheme → Assembly phases → Copy Bundle resources → Click + → Add assets or Simply add by clicking on the assets in your membership in the target membership.

see screenshot

enter image description here

enter image description here

Step 2: - Now, to configure the extension icon, click the "Extension" icon application from the target area, Go to the assembly settings → Search for assets directory compiler option → Enter the name of your application

see screenshot

see screenshot

+1
source

You have a lot of problems trying to solve this problem, but in the end I found a workaround (I don't like this, but it works):

I have finished installing the latest version of Xcode 7 . I opened my project using Xcode 7, and then followed the steps outlined in this answer: fooobar.com/questions/494450 / ....

Then I ran the project from Xcode 8 , and it worked like a charm.

0
source

All Articles