1

In my .NET MAUI app, I changed the icons used by the app from font based icons to PNG files and I store these images in Resources > Images folder.

I was able to successfully create a package and upload it to TestFlight but when I try to open the app, it crashes immediately. In crash logs, I see that the cause of crash is that the app was unable to load the PNG file I use for the Flyout i.e. the hamburger menu icon.

The other key change in the app is that it's now a .NET 7 based app.

I thought the publish process would add the PNG images used by the app to the ipa package if I placed them in Resources > Images folder.

Any idea what could be the issue here?

Here are screenshots of exception logs

enter image description here

enter image description here

And here's the MyApp.csproj file:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
        <OutputType>Exe</OutputType>
        <RootNamespace>MyApp</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>

        <!-- Display name -->
        <ApplicationTitle>MyApp</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.mycompany.myapp</ApplicationId>
        <ApplicationIdGuid>0636ab8b-e4f3-4c11-83e5-b809594a10b5</ApplicationIdGuid>

        <!-- Versions -->
        <ApplicationDisplayVersion>1.2</ApplicationDisplayVersion>
        <ApplicationVersion>68</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)'=='net7.0-ios'">
      <CodesignKey>Apple Development: Samuel Uresin (3YQ4LF4U5J)</CodesignKey>
      <CodesignProvision>VS: llc.iquest.ingrid.connect Development</CodesignProvision>
    </PropertyGroup>

    <ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\AppIcon\appicon.png" />

        <!-- Splash Screen -->
        <MauiSplashScreen Include="Resources\Splash\splash.png" Color="#262627" />

        <!-- Images -->
        <MauiImage Include="Resources\Images\*" />
        <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*" />

        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    </ItemGroup>

    <ItemGroup>
      <None Remove="Resources\Images\about_graphite.png" />
      <None Remove="Resources\Images\badge_graphite.png" />
      <None Remove="Resources\Images\biz_profile_graphite.png" />
      <None Remove="Resources\Images\coupons_graphite.png" />
      <None Remove="Resources\Images\customers_graphite.png" />
      <None Remove="Resources\Images\dashboard_graphite.png" />
      <None Remove="Resources\Images\feed_graphite.png" />
      <None Remove="Resources\Images\hamburger_manu_graphite.png" />
      <None Remove="Resources\Images\intercom_graphite.png" />
      <None Remove="Resources\Images\plus_graphite.png" />
      <None Remove="Resources\Images\power_graphite.png" />
      <None Remove="Resources\Images\qr_scan_graphite.png" />
      <None Remove="Resources\Images\qr_scan_large_graphite.png" />
      <None Remove="Resources\Images\search_graphite.png" />
      <None Remove="Resources\Images\settings_graphite.png" />
      <None Remove="Resources\Images\shop_graphite.png" />
      <None Remove="Resources\Images\single_user_graphite.png" />
      <None Remove="Resources\Images\subscriptions_graphite.png" />
      <None Remove="Resources\Images\user_profile_graphite.png" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Azure.Storage.Blobs" Version="12.14.1" />
        <PackageReference Include="CommunityToolkit.Maui" Version="3.0.0" />
        <PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
        <PackageReference Include="Ingrid.Aurora" Version="1.5.1" />
        <PackageReference Include="Ingrid.Core" Version="1.5.1" />
        <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.0" />
        <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
        <PackageReference Include="MonkeyCache.FileStore" Version="1.6.3" />
        <PackageReference Include="Plugin.InAppBilling" Version="6.7.0" />
        <PackageReference Include="Plugin.Maui.Audio" Version="0.1.0-preview1" />
        <PackageReference Include="Sentry.Maui" Version="3.23.1-preview.3" />
        <PackageReference Include="Syncfusion.Maui.Barcode" Version="20.3.56" />
        <PackageReference Include="ZXing.Net.Maui.Controls" Version="0.2.0-preview.2" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
        <PackageReference Include="SQLitePCLRaw.core" Version="2.1.0" />
        <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.0" />
        <PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.0" />
        <PackageReference Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.0" />
    </ItemGroup>

</Project>
4
  • I guess when you debug your application is not crashing? or you see the same exception in the log? Commented Nov 15, 2022 at 5:50
  • When I run the app in simulator, it works fine. The build and publish processes didn’t show any errors either. Commented Nov 15, 2022 at 6:00
  • Could you provide detailed crash log information? In addition, you said that you uploaded a package. Does the package you uploaded support .NET 7? Commented Nov 16, 2022 at 2:56
  • I uploaded screenshots of exception logs to original post. As per your second question, I have no indication anywhere that .NET 7 isn’t supported. I was able to run it successfully in simulators and create the package so I believe .NET 7 is supported. Commented Nov 16, 2022 at 5:10

1 Answer 1

2

I was setting the Flyout icon in Styles.xaml and this was the issue -- see below.

<Style TargetType="Shell" ApplyToDerivedTypes="True">
    <Setter Property="Shell.FlyoutIcon" Value="mymenuicon.png" />
</Style>

There's probably a way to set it in Styles.xaml and I'd appreciate it if someone can show me how to do that in the comments.

The fix for my problem was simply setting it in AppShell as follows:

<Shell
   x:Class="MyApp.AppShell"
   FlyoutIcon="mymenuicon.png">
  ...
</Shell>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.