Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: iOS 14 Black screen always on initial app launch prior to actually showing the splash screen [SplashScreen] #3589

Open
Exocomp opened this issue Sep 22, 2020 · 73 comments

Comments

@Exocomp
Copy link

Exocomp commented Sep 22, 2020

This bug is for the SplashScreen plugin described here.

Create an ionic app with capacitor, deploy it on the simulator or physical device:

  1. Launch the application
  2. Get black screen <-- this was not here prior to iOS 14
  3. Transition to the actual splash image

Here is an example of a project where you can reproduce it: https://github.com/Exocomp/demo-ionic-swippable-modal.git

Ionic:

   Ionic CLI                     : 6.11.8 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.2.3
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3

Capacitor:

   Capacitor CLI   : 2.4.1
   @capacitor/core : 2.4.1

Utility:

   cordova-res : 0.15.1
   native-run  : 1.1.0

System:

   NodeJS : v10.13.0 (/usr/local/bin/node)
   npm    : 6.4.1
   OS     : macOS Catalina
@AE1NS
Copy link

AE1NS commented Sep 24, 2020

Same here. Does someone have a workaround/quickfix for this?

@Deepfreezed
Copy link

Launch screen with image stopped working with iOS 14, Xcode 12. Only workaround currently is to not use an image.

@media4learning
Copy link

Same issue here, ios 14 fresh cap app launch screen on ios is black. If anyone finds a solution please post

@bolivir
Copy link

bolivir commented Sep 29, 2020

I see the same issue happening, launch app --> black screen --> Splash

@francodelsancio
Copy link

I see the same issue happening, workaround for now, not use background image, replace it with a view and make the launch screen in there by hand.

@chrisdelambert
Copy link

I have noticed a lot of apps displaying a black screen briefly before the launch screen on ios 14. I changed my SplashScreen plugin config to the below and the launch screen now displays: (delete the delay param)

"SplashScreen": {
"launchAutoHide": false
}

@Exocomp
Copy link
Author

Exocomp commented Sep 30, 2020

I see the same issue happening, workaround for now, not use background image, replace it with a view and make the launch screen in there by hand.

@francodelsancio can you please provide some steps on how to do this.

@chrisdelambert "launchAutoHide": false doesn't work still has the black screen.

@francodelsancio
Copy link

@francodelsancio can you please provide some steps on how to do this.
Sure, i remove the ImageView in LaunchScreen.storyboard and set a view instead, then i set the background color to the view, and added the logo with auto layout. I noticed that the images appear in the SDK but not in the device unless they are added in Bundle Resources (Build Phases).

Captura de Pantalla 2020-09-30 a la(s) 09 46 25

@Exocomp
Copy link
Author

Exocomp commented Oct 1, 2020

@francodelsancio thanks for the steps, I tried it and it's not solving the issue. Correct me if I'm wrong but your steps just set the initial logo it doesn't affect the splash screen.

So this is what I see after your steps:

  1. Launch app
  2. See logo
  3. Transition from logo to black screen
  4. Transition from black screen to splash screen

So unfortunately it is still not working.

@bolivir
Copy link

bolivir commented Oct 1, 2020

I have noticed a lot of apps displaying a black screen briefly before the launch screen on ios 14. I changed my SplashScreen plugin config to the below and the launch screen now displays: (delete the delay param)

"SplashScreen": {
"launchAutoHide": false
}

Above was the solution for me, i removed the other entries i had in there like launchShowDuration.
Now my config only contains the launchAutohide key. I just rebuilded the app and now i see no black screen appearing.

@francodelsancio
Copy link

@Exocomp i am sorry to hear that this not solve your problem, it seems, in my case, that the back screen is the background color coming from the imageView, because at run time its not loading from the resources, thats why i modify the launchscreen.storyboard, remove the imageView, added a view, set the background color, and put the logo.
In configuration I also set it to start with that storyboard. Regards

@Exocomp
Copy link
Author

Exocomp commented Oct 1, 2020

@francodelsancio it makes sense what you're saying but as soon as I add an image it goes to black, can you please include your LaunchScreen.storyboard file that will really help.

@francodelsancio
Copy link

@Exocomp i attach above an image of the tree in the splashscreen.storyboard if you change the background color of the elements you will notice that it is not loading the images. to load them you must attach them in the resource bundle. The assets folder are in the resource bundle, why are not loaded I don’t know. But the workaround works. All this assuming that we have the same problem. Regards

@ghost
Copy link

ghost commented Oct 6, 2020

Are there any updates on this problem here? Facing the same issues with the example app and its a pain point for me to see every time this black screen.
Appreciate every help/workaround; the ones mentioned above didn't work for me.

Best regards

@ghost
Copy link

ghost commented Oct 7, 2020

Same problem here, black screen of the dead... it's totally anoying for user experience. I'v not found workaround... any solution here ? an update ?

@Faisal49m
Copy link

Same issue here, tried all workarounds explained above didn't work, I was able to fix it in Cordova by removing the UILaunchStoryboardName from the .plist file but it didn't work here

@eddyD45
Copy link

eddyD45 commented Oct 16, 2020

I've tried all the proposed workarounds posted above and still have the same issue, usually with the black screen lasting for about 30 seconds to a minute before fully launching the app. It only happens on the first launch after installation; opening the app again a second time does not yield the black screen anymore. Are there any updates on this issue?

@kinggolf
Copy link

TLDR: What worked for me was to reduce file size of launch images.

I have 3 current Ionic/Capacitor/Angular apps. Two of them exhibit the same problem described here, initial black screen on app start prior to displaying actual launch image. The third never showed this problem and always started up fine.

After digging through all set-ups, configs, dependencies, ..., I found nothing to help my 2 problem apps. Just this morning I noticed the file size differences of the launch images:
good app: 29KB
problem apps: 145KB and 104KB

First I just pulled the launch images from the good app to one of problem apps and launch screen at start up was perfect, i.e. no black screen. Then I ran the launch images from 2 problem apps through squoosh - 145KB images reduced to 37KB and 104KB images reduced to 45KB. Put these new launch screen images into respective iOS apps and built onto my iPhone. Both app now start up perfectly with no black screen image.

Interesting note - both problematic apps are older and previously released to AppStore and have always worked fine. Something with iOS 14 definitely created this issue. Issue is not related to Xcode 12.

Possibly cordova resources would help this if used, but I have not tried.

I learned about squoosh from React Native Radio Podcast one of the most informative dev podcasts I've come across - even though I do no React Native development.

@nachshonfertel
Copy link

I have 3 current Ionic/Capacitor/Angular apps. Two of them exhibit the same problem described here, initial black screen on app start prior to displaying actual launch image. The third never showed this problem and always started up fine.

Tried this and it does not work for me.

@kinggolf
Copy link

Additional set up info in my apps, in case it helps, I am not using any splash screen plugin (Capacitor or Cordova). And no splash screen settings in capacitor.config.json. Just seems to work better for me.

@eddyD45
Copy link

eddyD45 commented Oct 20, 2020

TLDR: What worked for me was to reduce file size of launch images.

I have 3 current Ionic/Capacitor/Angular apps. Two of them exhibit the same problem described here, initial black screen on app start prior to displaying actual launch image. The third never showed this problem and always started up fine.

After digging through all set-ups, configs, dependencies, ..., I found nothing to help my 2 problem apps. Just this morning I noticed the file size differences of the launch images:
good app: 29KB
problem apps: 145KB and 104KB

First I just pulled the launch images from the good app to one of problem apps and launch screen at start up was perfect, i.e. no black screen. Then I ran the launch images from 2 problem apps through squoosh - 145KB images reduced to 37KB and 104KB images reduced to 45KB. Put these new launch screen images into respective iOS apps and built onto my iPhone. Both app now start up perfectly with no black screen image.

Interesting note - both problematic apps are older and previously released to AppStore and have always worked fine. Something with iOS 14 definitely created this issue. Issue is not related to Xcode 12.

Possibly cordova resources would help this if used, but I have not tried.

I learned about squoosh from React Native Radio Podcast one of the most informative dev podcasts I've come across - even though I do no React Native development.

Strangely enough, this somewhat fixed the issue for me. After reducing the splash image size, my app will load the splash image immediately. However, this only seems to be masking the underlying issue, as I still have a 1~2 minute hang-time before my app properly loads and hides the splash image. Either way, this fixes the original issue at hand, so thank you.

@arcbus
Copy link

arcbus commented Oct 30, 2020

I'll just throw my hat in the ring and also mention that i'm seeing this.

Had an older cordova project where indeed removing the UILaunchStoryboardName from plist worked, but haven't been able to solve it in capacitor :(

@aparajita
Copy link

Hang in there, next week I'll be releasing a new splash screen plugin that will fix all of these problems.

@Exocomp
Copy link
Author

Exocomp commented Oct 31, 2020

It turned out to be an image resolution for me, it was 2700x2700 initially, I dropped it down to 2300x2300 and I don't get the black screen anymore. If you try this just make sure to backup your original image so once this issue is fixed you can start using the higher resolution again. Note that the size on the disk stayed pretty much the same so not a size on disk issue. Thumbs up if this works for you too. 👍

@yacut
Copy link

yacut commented Nov 10, 2020

@aparajita Any progress on this? We really waiting for this fix... 😞

@aparajita
Copy link

@yacut Hopefully this week. I'm actually working on 3 killer plugins: splash screen, biometric auth, and console. It will be worth the wait. 😁

@angelolencina
Copy link

@aparajita hi my friend! any progress on this?

@aparajita
Copy link

@angelolencina 3 killer plugins became 4 😁, and I had a lot of work to do for my job, so it was a busy week. It looks good for releasing the splash screen plugin this week.

@angelolencina
Copy link

@angelolencina 3 killer plugins became 4 😁, and I had a lot of work to do for my job, so it was a busy week. It looks good for releasing the splash screen plugin this week.

Ok. Thank you!! 😁👍

@AE1NS
Copy link

AE1NS commented Nov 30, 2020

Hey @aparajita, do you have any news about the splash screen plugin?

At the moment our iOS App has a black screen and the Android App has a colored background (instead of a stretched image) before the ionic splash is displayed. Unfortunately there seems to be no proper solution until you rescue us 👍 Thank you for your effort, this sounds really great!

@eliassparagis
Copy link

I had the same issue until I replaced the splash png files with smaller ones. After that black screen gone and the capacitor livereload works as expected.
Working on mac M1 Big Sur 11.4

@hbjpn
Copy link

hbjpn commented Jul 1, 2021

In my case, the splash image was not shown, just see white blank image. ( iOS 14.6 and Xcode 12.5 with ionic 5 and capacitor 3.0)

Reducing the image size(in pixel) of the 3 files in the following folder works for me.
Assets.xcassets/Splash.imageset
splash-2732x2732.png
splash-2732x2732-1.png
splash-2732x2732-2.png

I resized the images from 2732x2732 (image size generated by cordova-res) to 2048x2048. Maybe reducing the image size less than 2732 pixel will result in slightly blurred splash image in e.g. iPad Pro 12 inch, but anyway splash screen works.

Note that the image "file" size seems to be not a matter as I confirmed 2732x2732 with 140KB does not work but 2048x2048 with 200KB images works.

This seems to be a problem in iOS 14, Apple should fix this issue. 2732 pixel splash screen is definitely needed to cater for the latest devices.

@dkiselew
Copy link

dkiselew commented Sep 8, 2021

I solved this problem by adding in XCode "iPhone" images to Splash.imageset with corresponding sizes (see Apple docs), looks like iOS 14 doesn't apply Universal image correctly:

Screenshot 2021-09-08 at 11 40 13

More about this: apache/cordova-ios#990

@franciscogar94
Copy link

I solved this problem by adding in XCode "iPhone" images to Splash.imageset with corresponding sizes (see Apple docs), looks like iOS 14 doesn't apply Universal image correctly:

Screenshot 2021-09-08 at 11 40 13

More about this: apache/cordova-ios#990

@dkiselew
Hi. What was the dimensions that u use for the Iphone Splash part?

@yanbodang
Copy link

I solved this problem by adding in XCode "iPhone" images to Splash.imageset with corresponding sizes (see Apple docs), looks like iOS 14 doesn't apply Universal image correctly:
Screenshot 2021-09-08 at 11 40 13
More about this: apache/cordova-ios#990

@dkiselew Hi. What was the dimensions that u use for the Iphone Splash part?

I use 375 * 812 (iPhoneX@1x)

@dkiselew
Copy link

dkiselew commented Oct 5, 2021

I solved this problem by adding in XCode "iPhone" images to Splash.imageset with corresponding sizes (see Apple docs), looks like iOS 14 doesn't apply Universal image correctly:
Screenshot 2021-09-08 at 11 40 13
More about this: apache/cordova-ios#990

@dkiselew Hi. What was the dimensions that u use for the Iphone Splash part?

2x image is iPhone 7/8 resolution: 750x1334 px
3x image is iPhone X resolution: 1125x2436 px
For 1x image you can use 2x image

@franciscogar94
Copy link

@dkiselew Thanks.
@EbenDang Thanks
I manage to resolve the problem using this 1125x2436 px resolution.

@daniel-7235
Copy link

Reducing the image resolution no longer helps for iOS 15.

@daviesdoclc
Copy link

daviesdoclc commented Nov 15, 2021

For me the issue seems to be cordova-res. It only generates and copies these to Splash.imageset.

splash-2732x2732.png
splash-2732x2732-1.png
splash-2732x2732-2.png

It also needs to generate a splash-1334x1334.png and then add the additional references in the Content.json appropriately

{
  "idiom" : "iphone",
  "filename" : "splash-1334x1334.png",
  "scale" : "1x"
},
{
  "idiom" : "iphone",
  "filename" : "splash-1334x1334.png",
  "scale" : "2x"
},
{
  "idiom" : "iphone",
  "filename" : "splash-1334x1334.png",
  "scale" : "3x"
},

I guess I'd also argue that you don't need 3 splash-2732x2732.png files. Just the one for all 3 scales would work?

sodenn added a commit to sodenn/2do-txt that referenced this issue Dec 6, 2021
sodenn added a commit to sodenn/2do-txt that referenced this issue Dec 6, 2021
* feat: hide keyboard shortcuts if not relevant

* feat: theme based status bar styling

* feat: sharing content via @capacitor/share plugin

* feat: optimize spacing on mobile devices

* feat: change browser tab color based on current theme color

* feat: add ios platform

* add capacitor splash screen plugin

* fix: reduce launch image resolution to fix the iOS 14 black screen on app launch problem (see ionic-team/capacitor#3589)

* chore: remove capacitor-resources dependency

* style: update app icons

* chore: update app images

* chore: update README.md
@Syahrul
Copy link

Syahrul commented Mar 4, 2022

None of these workaround work in ios 15.
I'm using Ionic 6, capacitor 3 and the black background still appears no matter what size or image I'm using.

One thing I noticed playing with Xcode. In file LaunchScreen.storyboard > View Controller Scene > View Controller > Splash
If I change the Image to one of the system icon?, the black background disappear and the splash screen work just fine. It display the splash screen with chosen icon as background. Maybe some one can shed some light on how to fix this?

Screenshot 2022-03-05 at 4 05 20 AM

@PeiJueChen
Copy link

Thx. This works for me. Remember to del app, restart the phone and install it again, or try to install it on another phone to see if it works. Because apple will cache the splash, it is difficult to test whether it works or not.

@Lzolcsi
Copy link

Lzolcsi commented May 12, 2022

@Syahrul I can confirm this behaviour with the system icons.
Unfortunately none of the solutions mentioned above worked for me.

@TheAngularGuy
Copy link

None of the solutions above worked for me. Still looking for a way to solve this

@jblackabraham
Copy link

Hi guys, really resizing the size will make it works, i just changed the splash screen to a smaller image make it works,
here's the reference explaining it in a better way why => https://stackoverflow.com/questions/63978396/launch-screen-not-working-on-ios-14-with-xcode-12

@giovw
Copy link

giovw commented Jul 12, 2022

My solution was to change the mode image in Photoshop to Indexed color.
Screen Shot 2022-07-12 at 00 28 31
Open in Photoshop
Screen Shot 2022-07-12 at 00 27 54
It worked for me.
Screen Shot 2022-07-12 at 00 32 47

@leixdd
Copy link

leixdd commented Jul 15, 2022

I fixed this issue in my project using this answer from stackoverflow.

https://stackoverflow.com/questions/58094614/ionic-capacitor-black-screen-after-splash

@aparajita

This comment was marked as spam.

@weihsth
Copy link

weihsth commented Nov 24, 2022

For me an entry was missing in the Info:

Key: Main storyboard file base name
Value: Main

@elmartino
Copy link

What helped for me to get rid of the black screen was:

  1. In xcode open LaunchScreen
  2. Select splash under the view controller
  3. At the top right set 'Highlighted' also to splash

@mendo96
Copy link

mendo96 commented Apr 18, 2023

In my case, the splash image was not shown, just see white blank image. ( iOS 14.6 and Xcode 12.5 with ionic 5 and capacitor 3.0)

Reducing the image size(in pixel) of the 3 files in the following folder works for me. Assets.xcassets/Splash.imageset splash-2732x2732.png splash-2732x2732-1.png splash-2732x2732-2.png

I resized the images from 2732x2732 (image size generated by cordova-res) to 2048x2048. Maybe reducing the image size less than 2732 pixel will result in slightly blurred splash image in e.g. iPad Pro 12 inch, but anyway splash screen works.

Note that the image "file" size seems to be not a matter as I confirmed 2732x2732 with 140KB does not work but 2048x2048 with 200KB images works.

This seems to be a problem in iOS 14, Apple should fix this issue. 2732 pixel splash screen is definitely needed to cater for the latest devices.

Doing this worked perfectly on ionic 6 capacitor 4. Thank you !

Important: Delete the app, restart the device, install new.

@ipehimanshu
Copy link

Hello

Does anyone have fix,

we are facing this issue with capacitor 5.

Please help

Thank you

@vochitan90
Copy link

for me the light mode alway show when launch screen.

I'm using capacitor 4

@TheAngularGuy
Copy link

Resizing the splashScreen Image to 2400x2400 (+ deleting the app and restarting the phone) solved the issue for me.

@joelrose2
Copy link

After reading tons of threads online and spending many hours trying to figure this out, I found a solution for eliminating the black screen that appears between the launch screen and the main app screen (something that I didn't see anyone else mention).

It is very simple: leave out the .storyboard extension of the name of the launch screen. With this small (and illogical) change, my launch screen remains visible until it is replaced by the actual app, no more black in between.

To solve this problem, I made this change in Info.plist:

From:

    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen.storyboard</string>

To:

    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>

You can also make this change by editing the "Launch screen interface file base name" property value to remove the .storyboard part of the name shown there.

I hope this helps others!

@anthonyjuarezsolis
Copy link

After reading tons of threads online and spending many hours trying to figure this out, I found a solution for eliminating the black screen that appears between the launch screen and the main app screen (something that I didn't see anyone else mention).

It is very simple: leave out the .storyboard extension of the name of the launch screen. With this small (and illogical) change, my launch screen remains visible until it is replaced by the actual app, no more black in between.

To solve this problem, I made this change in Info.plist:

From:

    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen.storyboard</string>

To:

    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>

You can also make this change by editing the "Launch screen interface file base name" property value to remove the .storyboard part of the name shown there.

I hope this helps others!

Actually I've had it like this for 7 months and the same problem continues.
image

@danielehrhardt
Copy link

Still no Capacitor fix here?

@sergiomilici
Copy link
Contributor

Hello, I've tried many things, but none of them worked.
This worked for me:

  • Resize all the splash images to be 2400x2400
  • In Info.plist change UILaunchStoryboardName to 
<key>UILaunchStoryboardName</key>
<string>LaunchScreen.storyboard</string>
  • Go to App -> General -> App Icons and Launch Screen and select LaunchScreen.storyboard and check Include all app icons (for this check I'm not sure the impact in the solution)
  • Delete the app, restart the phone and install it again. (this was needed for updating the icons, but for SplashScreen I think it's not necessary since I did other changes and I saw the results without restating)

NOTE
After doing the previous steps, I noticed that the SplashScreen appeared instantly, but disappeared after a few seconds. It turned out that launchShowDuration: 0 is not working correctly when launchAutoHide: false. As I understand, launchShowDuration is only used when launchAutoHide is false but this wasn't the case. Since I'm hiding it manually, I set 10 seconds of duration and now it's all working as expected.

Project type:

  • New & clean Capacitor 5
  • Added icons and splash screen with @capacitor/assets as it is in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests