o_w
o_w

Reputation: 683

Maui migrated app iOS app icon not showing when deployed

I have a migrated Xamarin.Forms app in Maui on .Net 7.0.

For some reason the iOS app icon is not showing at all when deployed, as if it is not set.

I have it both in csproj and info.plist exactly as it was under Xamarin.Forms.

ios csproj:

<ItemGroup>
    <ImageAsset Update="Assets.xcassets\AppIcon.appiocnset\icon[size].png">
         <Link>Assets.xcassets\AppIcon.appiocnset\icon[size].png</Link>
    </ImageAsset>
</ItemGroup>

info.plist:

<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiocnset</string>

But I don't see the icon when deployed.

Does anyone know how to handle the missing icon?

Upvotes: 1

Views: 2090

Answers (3)

jlo-gmail
jlo-gmail

Reputation: 5048

I could not get this work as intended with VS 2022 17.11.2. I ended up converting png to svg files (https://www.freeconvert.com/png-to-svg/download) and then editing the existing icon files:

  • Resources\AppIcon\appiconfg.svg
  • Resources\AppIcon\appicon.svg

Upvotes: 0

Kaushik
Kaushik

Reputation: 155

If you don't want to use Microsoft Doc way and you want to use your existing Xamarin Forms icons(png). You need to add IPhoneResourcePrefix in your .cproj to specify the path you want to use for iOS.

Example:

<PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
    <IPhoneResourcePrefix>Platforms/iOS/Resources</IPhoneResourcePrefix>
</PropertyGroup>

Here, use Platforms/iOS/Resources path for resource and added existing Assets.xcassets into the Resources folder. No need to change existing plist XSAppIconAssets value.

Upvotes: 1

Jessie Zhang -MSFT
Jessie Zhang -MSFT

Reputation: 13889

For this, you can check document : Add an app icon to a .NET MAUI app project.

In your project file, the <MauiIcon> item designates the icon to use for your app. You may only have one icon defined for your app. Any subsequent <MauiIcon> items are ignored.

The icon defined by your app can be composed of a single image, by specifying the file as the Include attribute:

<ItemGroup>
    <MauiIcon Include="Resources\AppIcon\appicon.svg" />
</ItemGroup>

For more information, you can refer to the documentation above.

Upvotes: 0

Related Questions