Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 374
Austin Fitzpatrick Avatar asked Sep 08 '14 22:09

Austin Fitzpatrick


3 Answers

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!

like image 116
Danny Avatar answered Nov 01 '22 05:11

Danny


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.

like image 20
Tom Harrington Avatar answered Nov 01 '22 05:11

Tom Harrington


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.

like image 26
David Avatar answered Nov 01 '22 05:11

David