maui: Splash Screen does not update iOS

Description

When changing the splashscreen (or icon), the changes are visible on both Android and iOS simulators, but when deployed to a physical device, it shows the original purple background with .NET in the centre.

I believe with the android device, there is another issue related to the icon being displayed instead of the splash screen, so the reproduction code was more for testing iOS then android. This is a known issue with the android version, so it was not tested

.NET Version: 6.0.400-preview22301.10 VS Pro Version: 17.3.0 Preview 2.0

Repro Code: https://github.com/camgra/maui-test-app

Steps to Reproduce

  1. Create a new .NET MAUI Blazor application
  2. Replace the content of splash.svg with another image. (I used a text editor to do this)
  3. Update the .csproj file, replacing the BaseSize value with 256,64
  4. Run the project on a simulator. I used an iPhone 13 Pro, 15.5.
  5. Note the splash screen has been changed
  6. Run the project on a device - I am using an iPhone 12 Pro, 15.5 for this. It is directly connected to Windows with Hot Reload, but it is paired to a Mac
  7. Note the splash screen remains with the stock “.NET” item.

Not sure if it is related or not, but I found that in order to run the app on a physical iOS device, I had to add an Entitlements.plist to the project. I didn’t see this documented anywhere, but I am only noting it here as it is different from the template

In another project, the same thing is happening with the icon which works with the simulator, but not with the physical device. I believe this has already been reported… but I assume they are related. The repro code does not have the icon changed

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 15.5

Did you find any workaround?

No workaround at this time

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 60 (32 by maintainers)

Most upvoted comments

@KamelDj37 the current workaround is to rename the icon file each time it changes.

There is a draft PR #10812 where we are looking to automatically generate the new image name for you.

I have the same issue. No matter what I tried the Splash and App icon will not update on the directly connected iPhone. Android works fine. I have deleted the bin/Obj folders, did a solution clean, removed app from iPhone and reset iPhone. Still the .NET logo and background are shown.

I will wait for it

That might be the only way - and luckily we generate so this is no work for you 😃

okays… so after a time that is too long to be happy about, I suddenly saw something… the OP was saying that they are using iOS hot restart (ios device attached to windows) and unfortunately the special app we use for that does not support changing the icon and splash screen. This is because the app is actually pre-built and using default assets.

I have started a discussion to either get dynamic asset support or at least change the default icon/splash to be different to the default template app so everyone knows it is special.

However, this does not do away with build agents and mac things not working.

I am trying to get a workaround (fix apple [il]logic), but this seems to work when swapping out the “filename” if the file changes.

Just add this to your .csproj:

<Target
    Name="_FixMauiSplashScreens" 
    BeforeTargets="ResizetizeCollectItems"
    Condition="'$(_ResizetizerIsiOSApp)' == 'True'">

    <!-- add a hash to each file -->
    <GetFileHash Files="@(MauiSplashScreen)" HashEncoding="base64">
        <Output TaskParameter="Items" ItemName="_MauiSplashScreensWithHashes" />
    </GetFileHash>

    <!-- update the inputs files -->
    <WriteLinesToFile
        File="$(_ResizetizerInputsFile)"
        Lines="@(MauiImage->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);IsAppIcon=%(IsAppIcon);ForegroundScale=%(ForegroundScale);ForegroundFile=%(ForegroundFile)')"
        Overwrite="true"
        WriteOnlyWhenDifferent="true" />
    <WriteLinesToFile
        File="$(_MauiSplashInputsFile)"
        Lines="@(_MauiSplashScreensWithHashes->'File=%(Identity);Link=%(Link);BaseSize=%(BaseSize);Resize=%(Resize);TintColor=%(TintColor);Color=%(Color);ForegroundScale=%(ForegroundScale);FileHash=%(FileHash)')"
        Overwrite="true"
        WriteOnlyWhenDifferent="true" />

    <!-- get the hash of the inputs file -->
    <GetFileHash Files="$(_MauiSplashInputsFile)" HashEncoding="base64">
        <Output TaskParameter="Hash" PropertyName="_MauiSplashInputsFileHash" />
    </GetFileHash>

    <!-- update the splahs items and set the filename to be the 'splash_<hash>' -->
    <ItemGroup>
        <MauiSplashScreen
            Update="@(MauiSplashScreen)"
            Link="splash_$([MSBuild]::ValueOrDefault('$(_MauiSplashInputsFileHash)', '').Replace('+','').Replace('/','').Replace('=',''))" />
    </ItemGroup>

</Target>

NOTE: This code is all sorts of hacky as I have to intercept various steps, but this will help make sure splash screen things trigger a new image filename. It probably also make incremental builds of these resources not happen, but that is better than no splash updates.

Does this issue happen .Net 7 version of Maui?

This happens in net6, net7 and in objc/swift using xcode from apple. This is not an app thing I think, just the iPhone os.

I have the same issue. Here is what I found out

  • I have this issue on both ios emulator and iPhone. Not android (or at least it fixes itself much faster so i didn’t notice)
  • It could be relared to this old issue on Apple forum https://developer.apple.com/forums/thread/68244
  • I uninstalled Visual Studio, all versions of dotnet. Deleted all the temp directoreis i could find, reinstalled all from scratch and still no luck.

Workaround that i found that usually works is this

  • delete app from device/emulator and clear all data
  • clean solution
  • reboot device/emulator (this step is important)
  • build and deploy app

The workaround works while developing but will probably not work on customers devices if the splash screen gets updated between versions. Unless they delete their app and data from the phone and reboot.

I run VS 17.3 on Windows 11 with the version of maui that came with it. Didn’t test on other dev setups

I’ve run this also. This worked for me (mentioned by @kajetan-kazimierczak )

  • delete app from device/emulator and clear all data
  • clean solution
  • reboot device/emulator (this step is important)
  • build and deploy app

Before i tried to delete bin/obj and clean the solution. This alone was not enough. Rebooting the emulator after de-installation did the trick.

Hello, the problem persists for me. The application always generates a default start screen and icon on ios (physical).

@mattleibow I will give it a go with apples testflight. Hopefully it will have the correct assets, thanks for responding! 😃

or use the workaround in the comment above: https://github.com/dotnet/maui/issues/8685#issuecomment-1286038152

Let me know if this fixes things. I will be doing this for officials here: https://github.com/dotnet/maui/pull/10812

I will test on xcode and see. I hear rumors that it does not have this issue and this makes me very scared.

If this still is the case, I will investigate some guid thing.

But thank you so much for the confirmation of the issue.

I’m also having this issue. I’ve renamed the svg’s and uninstalled and reinstalled with no luck. When I hold the icon down it doesn’t update. My splash screen is also the .NET default despite having changed it in code. Everything works fine when I deploy to both my android phone and the android simulator.

Now I got some interesting things with the icon, it does not change on the device… but it does actually. I have the old image on the start screen, but when you open/close it, the zoom animation uses the new image. I tried using a new image file and I get the same result.

After uninstalling the app and re-deploying it worked.

https://user-images.githubusercontent.com/1096616/195175538-fab7ee28-01d8-4aa2-a3fc-439a9b76a4b7.mov

if you will change name for svg file it will be changed

@jfversluis, I tried several combinations of this before with no success. I also remove the solution from my PC and pulled it down from source control as well (since the bin and obj files are not included in the repo). I ran it again on the simulator and confirmed that the splash screen was updated, and then tried on the physical device (iPhone) and it showed the original .NET splash screen. It also crashed with the following (on the physical device only): **System.Exception:** 'Could not find a .content folder in the app directory: /var/containers/Bundle/Application/6C321DA5-B789-41AD-8BE6-3E1922918ED2/MauiApp1.app'. I don’t know if that is related or not, but it is new since pulling and rebuilding it.

Just to rule out the iPhone I use for testing, I also provisioned an iPad that has not been used before for development and deployed the app to that. This test produced the same result as the iPhone, with the old splash screen and same system exception.

Definitely there is some caching going on with this sometimes. Would you be able to confirm if you do a clean, rebuild, maybe delete your bin & obj folders and delete the app from the device if it was installed before? Does that help at all?

For me it happened that if I had an old app with the same name, it keeps running the old app or some of its parts