Xamarin forms: Launcher icon for ios

2019-07-11 04:03发布

问题:

I am trying to set the launcher icon for xamarin forms ios project from Mac.

I do the following things but still showing the default icon.

1.Double-Click the Info.plist file in the Solution Explorer to open it for editing.

2.Scroll down to the App Icons section.

3.From the Source dropdown list, select AppIcon-1.

4.Open Assets.xcassets and select App icons from the list.

5.Select the image file for the required type(Prerendered option is not checked). Some icons are already filled with the default icon and if I change that will get the file not found error.

XSAppIconAssets path in Info.plist is:

<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon-1.appiconset</string>

Is there any additional set up for this task? I refer this blog: https://docs.microsoft.com/en-us/xamarin/ios/app-fundamentals/images-icons/app-icons?tabs=vsmac

Thanks in advance.

回答1:

It is because that Assets file path doesn't match the vaule in info.plist, your application cannot find it so use the default icons.

  1. Right click info.plist and open it with XML(Text)Editor, you can find

    <key>XSAppIconAssets</key>
    <string>Resources/Images.xcassets/AppIcons.appiconset</string>
    
  2. Right click Assets.xcassets and open containing folder , select its parent folder, you can find it locates at YourApp.iOS not Resources.

Solution

Change XSAppIconAssets from Resources/Images.xcassets/AppIcons.appiconset to Images.xcassets/AppIcons.appiconset , it should be able to solve the issue.