ActionExtension Icon - ios

I'm trying to change default Action Extension icon but unfortunately no result. Some topics I could find look outdated already.
What I already did:
Added Assets.xcassets folder to the ActionExtension folder.
Added App Icon type image named AppIcon and provided all image sizes with transparent background.
In Build Settings of the Action Extension for Primary App Icon Set Name field set AppIcon as a value.
So I see the target image was changed but still in the iPhone gallery where I try to run the action extension it shows default main app icon.
Would be thankful for any suggestions.
Thanks

Related

Xamarin LaunchImage not listed as a source in ImageView properties

I'm working on a mobile app for iOS/Android. I'm using Visual Studio Community for Mac version 8.1.5, and the project was initially created as a new Tabbed Forms Xamarin App.
When the new project was created, the Assets.xcassets "folder" already contained two items - AppIcon and LaunchImage, with the LaunchImage screen looking like this:
I didn't create this, it already existed. There was also a LaunchScreen.storyboard file, and in the info.plist file, the iPhone Launch Images setting was already set to LaunchImage (the name of the image set in xcassets that already existed and which is shown in the screenshot above), and the Launch Screen setting was set to LaunchScreen:
I then added a bunch of images to a subfolder in the Resources folder, added each image to the correct box in the xcassets screen, saved everything and then tried to add an image to the LaunchScreen.storyboard file.
Unfortunately, when I add an Image View control to the Launch Screen, the Image dropdown in the widget properties does not list the LaunchScreen as an asset I can use!
If I create a new Image Set in the xcassets folder, it creates a screen like this:
This has nowhere near the number of different images sizes (I guess because it's a general image, not an image specifically for the launch screen), but, I can set the Image View on the launch screen to use this set.
So my question is: how can I use the LaunchImage screen (with its many different sizes for different devices) as the source of an Image View widget on the LaunchScreen story-board? What am I missing?
Here is the guide for Launch Screens for Xamarin.iOS Apps .
You can pay attention to the third section of this chapter (Managing Launch Screens with Storyboards) ,
Add an image to the Assets.xcassets Asset Catalog so that it is available for use on the Launch Screen. For more information, see the Adding Images to an Asset Catalog Image Set section of the Displaying an Image guide.
Explain:
If clicking Launch Image selection. ImageView's droplist can not see it.Because this is used as System image, and if want to show in LauchScreen. You should set in info.plist as follow: (Only set Source , not set LaunchScreen)
If clicking Image Set In Asset Cattalogs , then ImageView's droplist can see added ImageSet Name there.But first need to set info.plist as follow:

how to set app icon of app in xamarin.forms app for IOS

i have idea about how to set app icon image where we were putting all respective size icon images in resource folder.
in recent xamarin update there is no need to add multiple size images for splash screen using storyboard.
so my question is there something also for app icon also? so we need not to add multiple icon images??
any suggestion most welcome.
Add in Asset Catalog.Add an different sizes of icon and set that in infoplist.
Go to Assets.xcassets in Xamarin ios project, you will get a default AppIcon image set there which is by default using Xamarin logo.
Replace those images with you icons, make sure the resolutions your image follows the required resolutions/pixels for each (1x,2x&3x) type of images.

How do you provide an icon for an action extension?

All the extension types use the containing app's icon, with the exception of action extension. The Apple documentation says this:
In iOS, a custom Action extension uses a template image version of its
containing app’s icon, which you must provide.
However it does not say how you must provide the icon. It says:
For information on how to add an icon to your app extension, see
Creating an Asset Catalog and Adding an App Icon Set or Launch Image
Set.
But the links to "Creating an Asset Catalog" and "Adding an App Icon" documentation are links to how to add an icon for an app, they don't contain a section on how to add an icon specifically for an action extension.
The extension target does not contain an app icon section in the XCode general settings (unlike an app), so its icon presumably must be added via an asset catalog. However, even after I added an app icon image set to my extension's asset catalog, the extension's icon is still not appearing.
How am I supposed to add an icon for an action extension? And if it's via its asset catalog then why is that not working when I've added an icon image set to the asset catalog?
First, you need to have an asset catalog. You may already have this but if you don't, this is easy to create.
Click on the group that contains the extension files.
From the File menu, select New > File....
In the iOS section, click on Asset Catalog and then click Next.
Second, we need to add the app icons to our project. Note that the icons must have a transparent background. If you try to use icons with a solid background, iOS will not display the icon.
Click the + button and choose App Icons & Launch Images > New iOS App Icon.
By default, Xcode will call the icon AppIcon but it will also warn you that this name is in use. To remove this warning, choose a different name (e.g. AppIconExtension-iOS).
Drag your icons into the 60px placeholder. You will also need 120x120 (aka #2x) and 180x180px (aka #3x) icons. You can create additional icons if you want but these are not necessary.
Third, you need to tell Xcode to use the icon when building the extension.
In the Project Navigator, select your project at the top of the tree.
Select your extension as the Target and select Build Settings.
Search for Primary App Icon Set Name (or Asset Catalog App Icon Set Name before Xcode 15) and enter the name of your icon.
Build and run the extension.
In order to get it to work its not enough to add the assets to the asset catalog - its additionally necessary to set the Asset Catalog compiler options of Build Settings section of the extension to specify the name of the app icon set within the asset catalog:
We need a monochromatic icon for Extension application which has exactly same dimensions & type as we set on Appicon(Only name & icon type is differ).
Firstly we need to include assets to the extension target
Step 1:- For adding assets click on extension scheme->Build phases
->Copy Bundle Resources ->Click + -> Add assets OR Just add by click on assets in your extension target membership.
refer below screen shot
Step 2:- Now for setting up extension App icon click on Extension
application from targets area, Go to build settings ->Search Assets
catalog compiler option ->Enter your App icon name
refer below screen shot
The documentation for action extension icons isn't particularly helpful—try this answer, which provides a worked example, or this answer coupled with the discussion continued in chat.
For the icon itself, current guidance is as follows:
Use a template image for an action extension icon. A template image uses a mask to create an icon. Use black and white with appropriate transparency and antialiasing, and don’t include a drop shadow. Template images should be centered in an area measuring about 70px by 70px.
Got a lot of troubles trying to solve that problem but I eventually found a workaround (I don't like it, but it works):
I ended up installing the last version of Xcode 7.
I opened my project with Xcode 7 and then I followed the steps provided in this answer: https://stackoverflow.com/a/27333408/3844377.
Then I ran my project from Xcode 8 and it worked like a charm.
for Xcode 14, the key has changed to Primary App Icon Set Name in the Build Settings section of the extension

How to set the apple watch icon image in iOS

I want to add the apple watch app icon image in Glance option shown in iPhone(Please refer attached image).I have added all the appIcon images shown in asset file. But icon image is not visible in iPhone for glance option. So where to add icon image for this ? Thanks in advance.
2 Points:
Make sure that you have added your app icon in XCAsset of "ProjectName WatchKit App" folder.
Turn on car play as well. (I am not sure if it is required, but you can try.)
Just as an fyi make sure all icons are .png format and de-interlaced. Also no transparency on the Home Screen icon.
It may be a bit unclear, because if you use a standard XCode template App, you may find two Assets.xcassets. The first would be under the WatchKit App and the second one under the Watch Kit Extension, usually where you insert your code logic.
Well, check out the Assets.xcassets under the WatchKit App group-folder, that’s the one. You will find in this image assets the AppIcon group, fill the icons and you are good to go.
Original source:
https://www.jazzcoding.com/locate-real-watch-icons-assets/

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.
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).
I made sure to include Images.xcassets in the Copy Bundle Resources build phase:
And then when running the app in the simulator everything works!
Compiling to device however results in a blank icon:
I thought maybe that means something is wrong with the PNG file I'm using, but everything looks OK here too:
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:
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.
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.
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.
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.
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!
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.
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.
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:
It feels a little bit like a bug...
To get this to work with my existing Asset Catalog, I had to add the following to the extension's Build Settings:
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.
Problem seems to be solved on iOS 8.1.

Resources