16

Edit2:

I've distilled the problem down to the simplest project I can. Here's the setup. Basic project setup

I created a new single view app and immediately added a new Action extension target. I created a new icon set in the .xcassets file and added an iPad retina sized icon (I've tried filling in all the icons, the results are the same).

enter image description here

I made sure to include Images.xcassets in the Copy Bundle Resources build phase:

enter image description here

And then when running the app in the simulator everything works!

enter image description here

Compiling to device however results in a blank icon:

enter image description here

I thought maybe that means something is wrong with the PNG file I'm using, but everything looks OK here too:

enter image description here

Has anyone encountered similar?

I've already visited questions like this looking for an answer and I think I'm doing everything right but I'm still not seeing an icon in the action sheet.

Here's what I've done:

  1. Created a working container app that has a working app icon stored in Images.xcassets. Then I created an Action Extension Target as a member of the same project.

  2. Added Images.xcassets from my containing app to my extension's "Copy Bundle Resources" build phase. I know that this worked because I'm able to load images from the .xcassets file using UIImage.imageNamed(...) in my extension.

  3. In the General Tab of the settings for my extension I've pointed the "App Icons Source" under "App Icons and Launch Images" to point to Images.xcassets's resource called "AppIcon", the same used for my containing app.

  4. When that didn't work I did some further reading and discovered that Action Extensions require an "alpha mask" style image. I created another item in my .xcassets file called "AppIcon-2" and populated it with all sizes of app icon, except as a 1-color + transparency PNG. I pointed "App Icons and Launch Images" of my extension to this new "AppIcon-2"

Still my action extension's icon is a blank white square. Are there any steps that I'm missing? Is there some very specific format the alpha mask has to be in? (I'm just saving as a .png in photoshop). Is there some very specific name the resource has to have in .xcassets?

I'm also confused by some of the answers (like the one linked above) which seem to imply that the issue is resolved by adding .xcassets to the build phase. Aren't most app icon's completely opaque? How does iOS generate an alpha mask from a completely opaque app icon?

Edit: I'm not entirely sure what change made the difference (I'll try to deduce it and update this post if I figure it out) but I'm now seeing a working icon based on the alpha mask of "AppIcon-2" on the simulator. I hadn't even thought to check the simulator but it does prove that the icon is being pulled from the correct place. Something about the device is processing the image differently.

Austin Fitzpatrick
  • 7,243
  • 3
  • 25
  • 22
  • Another thing I figured out: on the simulator using ```iPad Retina (8.0)``` the icon does not show up, but on other simulators it does! This feels like a bug on XCode... – powtac Sep 22 '14 at 10:18
  • Make sure you do a XCode: Project > Clean and a iOS Simulator: Reset Content and Settings... after each test. Sometimes it seems that that icon changes are cached... – powtac Sep 24 '14 at 13:18
  • I figured something out: in the global log console (iPhone is attached via USB) this shows up when starting the Action Extensions: ```Sep 25 16:22:14 ASDF-iPhone MobileSlideShow[2643] : Cannot access extension bundle. Sep 25 16:22:14 ASDF-iPhone kernel[0] : Sandbox: MobileSlideShow(2643) deny file-read-data /private/var/mobile/Containers/Bundle/Application/ASDFF5A9-4BCD-4B60-B82B-8DC3CC98184A/Test Icon.app/PlugIns/ex.appex``` Were "Test Icon" is the my main App and "ex" my Extension App. – powtac Sep 25 '14 at 14:24
  • Nice find. Still not sure how to fix it though. – Austin Fitzpatrick Sep 25 '14 at 18:41
  • This is not directly an answer to the question, but a very useful list of workarrounds on the topic of "A collection of issues with iOS 8 share extensions, along with radar links, sample projects, and workarounds" https://github.com/tumblr/ios-extension-issues – powtac Jan 14 '15 at 12:06
  • I have exactly the same for today extension. There is no Icon app on devile, while there is an icon on simulator. Why? – Bartłomiej Semańczyk May 14 '15 at 06:56
  • I have the same problem. Check it http://stackoverflow.com/questions/41297689/app-icon-of-share-extension-is-not-updating-in-device-even-with-updating-app-ico/41568240#41568240 – Александр Ожгибесов Jan 10 '17 at 11:58

6 Answers6

4

EDIT: Apple Fixed this issue in iOS8.1!

------------ OLD ----------------------

I think at this point, the answer is to submit a bug report to Apple at

https://feedbackassistant.apple.com/

If you can submit your barebones example project, that will help our cause!

Here's the one that I submitted:

Summary: The action extension icon shows well from Messages, and the UIActivityViewController, but when it appears from the Photos App, the icon is blank.

I think this is a bug with the Apple Photos App

Steps to Reproduce: Follow these instructions but from the Photos App

http://www.photoinvestigator.co/blog/how-to-use-ios8-action-extensions/

Expected Results: Expect the Metadata Extension's icon to appear correctly as in http://www.photoinvestigator.co/blog/how-to-use-ios8-action-extensions/

Actual Results: The icon is pure white

Version: iOS 8.0.2, iOS 8.0.0

Notes: iOS 8 action extension icon is blank on device (works in simulator)

Here is an example of using my extension from Messages App, with the icon showing correctly: http://www.photoinvestigator.co/blog/how-to-use-ios8-action-extensions/ But doing these steps from Apple's photos app, results in the icon not showing correctly.

Configuration: Any iOS device running iOS8. iPad 3rd Gen, iPhone 5, iPhone 5c, iPhone 6 Plus

Attachments:

Edit: They closed it as a duplicate of ID: Ticket ID: 17208813 Progress!

Cœur
  • 37,241
  • 25
  • 195
  • 267
Danny
  • 397
  • 3
  • 9
2

You didn't mention the extension's Info.plist settings, so I assume you didn't include an entry for the icon file. You'll need to add a key named NSExtensionServiceToolbarIconFile in the NSExtensionAttributes dictionary. The value is the name of the icon file.

At least that's how it's supposed to work. In practice it seems that you currently need to have a top-level CFBundleIconFile key with the icon's name. Supposedly that's only used if NSExtensionServiceToolbarIconFile isn't present, but at least for now it's necessary. I have both, which is probably not necessary, but I'd prefer to leave the key that's documented as being correct in place in case it starts working at some point.

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
  • Still no good, assuming I'm doing it right. I set the value to "AppIcon" (also tried "AppIcon-2", "Images.xcassets" and "Images"). I put it in the NSExtensionAttributes dictionary but also tried it as a direct child of NSExtension. https://developer.apple.com/library/prerelease/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/SystemExtensionKeys.html describes the key as being OS X only (but I understand the documentation isn't always flawless). Has this worked for you? – Austin Fitzpatrick Sep 08 '14 at 23:14
  • No, answer updated. I'm doing this right now and I realized I left out a detail above that I had used on a different extension. – Tom Harrington Sep 08 '14 at 23:23
  • Thanks for your help but that didn't seem to work for me. What value are you setting for the CFBundleIconFile key? "AppIcon"? What does your app icon look like? Is it completely opaque or is there transparency? Is it the same one your main app uses? – Austin Fitzpatrick Sep 09 '14 at 00:04
  • The setting is the icon file name, without an extension and without `@2x`. So the icon is named something like `foo-icon@2x.png` and the value I use is `foo-icon`. The icon is opaque, and it's not the same as the containing app's icon, it's an extension-only icon. – Tom Harrington Sep 09 '14 at 00:08
  • This is for an Action extension or a Share extension? I haven't had a problem with setting icons for Share or Photo Editing extensions, its only Action Extensions which are the grayscale ones similar to "Print". What does your icon look like? Is it just a grayscale version of your opaque icon? – Austin Fitzpatrick Sep 09 '14 at 00:19
  • Action extension. The icon appearance is completely different from the app icon. I don't know what you're doing wrong but the above steps have worked for me. – Tom Harrington Sep 09 '14 at 02:35
  • 4
    I have the same problem. Tried the steps above it does not work. Strange though that it only affects Action extension in Photos.app for me. Does not affect the same Action extension in other apps. – honcheng Sep 10 '14 at 05:53
  • 3
    ```NSExtensionServiceToolbarIconFile``` is for OS X only (not iOS!) according to the documentation: https://developer.apple.com/library/prerelease/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/SystemExtensionKeys.html#//apple_ref/doc/uid/TP40014212-SW19 – powtac Sep 25 '14 at 11:06
2

I had the same problem. What worked for me was to follow Tom Harrington's answer, but then also make sure the 'Target Membership' (right side pane) of the extension icons includes both the extension target AND the app target. (Under Build Phases, it should be listed under Copy Bundle Resources for both targets as well.)

Also, note that your extension icons must have a fully transparent background, NOT solid white. Any white, or any colour other than transparent, will be rendered as solid dark grey.

Hope this helps. Sorry, I wanted to add this as a comment to Tom's answer, but Stack Overflow wouldn't let me because of my reputation.

David
  • 139
  • 2
  • 5
  • Thanks, no magic here though. Just to try to replicate what you're doing as closely as possible - are you using .xcassets or just files added to your project? (I've tried both but maybe I could limit my search). How are you creating your PNGs? Just photoshop "Save As..."? – Austin Fitzpatrick Sep 10 '14 at 05:12
  • 1
    Hi David, are you sure it is working in Photos.app? The icon should show up in other apps without problem. It's just Photos.app – honcheng Sep 10 '14 at 06:15
  • @honcheng, post that as an answer and I'll accept it. It works in other apps, its Photos.app on device that doesn't work. I can't believe how long I spent troubleshooting that. – Austin Fitzpatrick Sep 10 '14 at 06:31
  • @austin no I don't have a solution for that. I have the same problem as well. Just not sure if both solutions posted here are just referring to other apps or Photos.app specifically. Thought it must've been a bug since the same extension works in Safari but not in Photos – honcheng Sep 10 '14 at 06:39
  • Hi, sorry, I missed the part about it being specific to Photos.app. I was trying it in Safari, where it works. My extension doesn't deal with images. – David Sep 10 '14 at 13:25
2

We have the same problem for our Yarnee App. But I figured out that beside Camera Roll, the icons work on other Apps, for example Dropbox, see this screenshot:

enter image description here

It feels a little bit like a bug...

powtac
  • 40,542
  • 28
  • 115
  • 170
  • This is what I eventually realized too. I just submitted to the app store with a non-working photos.app icon. – Austin Fitzpatrick Sep 22 '14 at 00:38
  • @AustinFitzpatrick We also submitted without working icons and we got approved. Btw. the Wunderlist App has a proper working icon... – powtac Sep 22 '14 at 10:05
  • I've been getting support emails about this. Sure wish I could make the action extension icon show up from Photos.app ! It looks great in Messages, etc :( – Danny Sep 26 '14 at 20:12
2

To get this to work with my existing Asset Catalog, I had to add the following to the extension's Build Settings:

enter image description here

The name of the set in my Assets Catalog is "ExtIcon". I had tried setting the CFBundleIcon and the NSExtensionServiceToolbarIconFile keys in the info.plist for the extension, but had no luck. This actually seems to make sense since it is the same way that icon sets are linked to the container app, not via info.plist, but via the Build Settings.

mahboudz
  • 39,196
  • 16
  • 97
  • 124
  • 1
    This setting is set, but still does not work for me. Although it looks like your Icon is full colored. Mine in b/w only. But the parent app's icon is full colored... – powtac Sep 22 '14 at 10:17
  • That was a test icon. It showed up as a black rounded square. Now I have replaced it with a mask B&W image. – mahboudz Sep 23 '14 at 11:40
  • Worked for me. Thanks!! Literally tried everything else. – Sherwin Zadeh Jun 25 '20 at 21:58
1

Problem seems to be solved on iOS 8.1.

iOS Action Extension Icon

powtac
  • 40,542
  • 28
  • 115
  • 170