xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 514 forks source link

[Bug] iOS 14 Launch Screen is not working #9764

Closed Deepfreezed closed 4 years ago

Deepfreezed commented 4 years ago

Description

iOS 14 Launch Screen with image is not working. Works fine on iOS 13.7. If I remove image and set a background color, Launch screen will show the background color. If I set an image, neither the background color or image shows. Issue can been seen on both simulator and device.

It also looks like Apple has changed Launch Screen functionality with iOS 14. It mentions old method should still work. We cannot switch to the new method and leave version earlier than iOS 14 behind.

https://useyourloaf.com/blog/dropping-launch-storyboards/

Steps to Reproduce

  1. Update device to iOS 14. Update Xcode to 12.
  2. Create Launchscreen.storyboard with an image
  3. Set info.plist Launch Screen to Launchscreen storyboard above

Expected Behavior

Launch Screen with image to display in iOS 14 like it does on iOS 13.7

Actual Behavior

Black Launch Screen

Basic Information

Workaround

JacquesSG commented 4 years ago

Same issue here. We have multiple targets/schemes and some kept on working. So I checked all target memberships and both the launch screen (linked to all targets) as well as the image on it (linked to specific target) seems to be ok.

chamons commented 4 years ago

Thank you for your feedback!

For us to investigate this further, could you please provide a small sample showing the specific issue? Project plist configurations can change behavior significantly.

We look forward to hearing from you!

JacquesSG commented 4 years ago

It's the same entry for all targets:

UILaunchStoryboardName Launch Screen

screen1 screen4 screen3 screen2

chamons commented 4 years ago

I tried a small sample app against Xcode 11.7 and Xcode 12:

AppWithLaunch.zip

I can not reproduce your issue. Please attach a sample showing the behavior in question.

kerberosargos commented 4 years ago

I am using Xamarin Forms but same issue is for me too. After launch screen app shows black screen.

chamons commented 4 years ago

@kerbooo - Please attach a sample project showing the issue. This is current in need-info as I am not able to reproduce it. Without that, or more details so i can, this issue will be closed.

Legolas87 commented 4 years ago

I also have this problem, please do not close issue without doing anything, problem really exists.

kerberosargos commented 4 years ago

Hello everyone I have solved this problem fixing Info.plist

7 Eki 2020 Çar 11:26 tarihinde Armen notifications@github.com şunu yazdı:

I also have this problem, please do not close issue without doing anything, problem really exists.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xamarin/xamarin-macios/issues/9764#issuecomment-704778780, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWWPUCJOKFH6SYNWHLLQPTSJQQ3JANCNFSM4SA5HTYQ .

ianthetechie commented 4 years ago

@kerbooo what did you have to "fix" in Info.plist?

@chamons I'm also experiencing the issue on a 2.5 year old Xamarin.Forms project. The only thing that changed was updating to Xcode 12. It's definitely broken, and definitely a Xamarin-specific issue.

Additionally, while attempting to generate a project for you guys since the project I'm working on is proprietary, I get this error when opening the brand new project's storyboard in Xcode. So that's a non-starter.

image

So ok, whatever... I'll deal with the awful built-in iOS Designer. Open that up and I see a blue field and what looks to be a poorly positioned image reference that can't be found.

image

Inspecting the source, it looks to be a reference to one of the app icons. Launching the app in the simulator shows a blue field, but no image.

So this is better than flat black, which is what my existing app shows, but it's still broken in a rather odd way. At the very least, the sample projects, which I've attached with no modification, are broken. test.zip

chamons commented 4 years ago

Thanks for the test project @ianthetechie !

I'll take a look shortly, and see if I can reproduce what you are seeing locally.

chamons commented 4 years ago

I do not believe this is a Xamarin.iOS bug, but a behavior change from Apple.

Here's the detail. As described here:

https://developer.apple.com/forums/thread/19759

It seems that assets in Assets.xcassets are not accessible in time for the launch screen anymore on iOS.

If I copy an image out of it, and include it directly: test2_copy_image.zip or if i use a system image: test2-system_image.zip it works just fine.

Given that other folks are seeing this as well, and are not using Xamarin, I'm going to close this as "Apple behavior change".

Please reopen if you have reasons to believe that somehow this is Xamarin specific.

Legolas87 commented 4 years ago

@chamons please look at this example with larger image... test.zip

chamons commented 4 years ago

@Legolas87 - I believe the problem is the 9 meg image you tried to load as a png. I converted it to a small jpg and it works on my device. I've had difficulties getting any launch screen to show on simulator.

Here is the project: test2.zip

Deepfreezed commented 4 years ago

@chamons Thanks, your solution worked.

Yes, this looks like a iOS 14 issue. Use image outside of Asset Catalog. Make sure image is not larger than 2400px.

JacquesSG commented 4 years ago

We use three pdf images in our code. Two are way too large indeed and when I remove or resize them it works as expected. Putting them outside xcassets is not really necessary. You have to restart your device to have new images in xcassets for launch screens to have effect.

cfhawksbay commented 4 years ago

I had the same problem, just one view with one image (jpg 2732x2048 px), always worked fine, now showing black screen. Solved it as below, did not resize the image file. I assigned a non-existing image to the UIImageView then launched App. Then reselected my original imagefile (.jpg) and ran app again and now all is working as before. I did not have to reduce the size.

broli84 commented 3 years ago

I have been struggling with this for an entire day.... What did the trick for me was to uninstall the app and restart the phone. After that my launch screen showed just fine!

Alextorres950325 commented 3 years ago

look this https://useyourloaf.com/blog/dropping-launch-storyboards/ with the new UILauchScreen the UILaunchStoryboardName on iOs 14 doesn't work

thiesitease commented 3 years ago

Just my two cents. Had the same issue, Splash Screen was blank, but days ago it was working. Checked the XML File, but there was only the Xamarin Default Content. So built the splash again by double clicking the storyboard file in VisualStudioMac, works fine, can compile and looks good. But when checking in, I recognized, that no change was made to my storyboardfile.

Solution: By double clicking, VS/xcode opened my storyboard from the OBJ folder and every change was made there, not in my resource folder. I had to copy the storyboard file from the OBJ Folder to the resource folder and everything was fine.

martinsmithdev commented 3 years ago

I'm seeing the same issue on iOS14 - no launch images show, although they work on older iOS versions (e.g emulators)

heymeltbot commented 3 years ago

I also experienced this issue and found success in changing the launch image to .jpg from .png. The image is housed within the resources folder in the iOS project, not within the Images.xcassets folder. Didn't have to resize. For detail, my issue was that on launch, it would only show a black screen - new issue with iOS 14.

Kapusch commented 3 years ago

Thank you @chamons for having provided examples ! Copying the content of your storyboard into my storyboard has fixed my issue.

The only difference I've been able to notice is that "initialViewController" tag was missing in my storyboard.

Deepfreezed commented 3 years ago

Anyone still having storyboard issues, move your storyboard creation to XCODE. Visual studio does not work any longer. Also, if the image goes missing when the app launches for no apparent reason, delete the image used from your iOS project resources, rename the image to something else and add it back into the project. You can viewsource of the LaunchScreen and manually replace the image reference without going to XCODE storyboard.

sisaacks commented 3 years ago

Yup I am still having this issue.....everything was working fine...then I updated and now all I do not get the image anymore when the app starts. Super frustrating. My image is under resources but will not show at all. All I get is the little Xamarin logo.

sisaacks commented 3 years ago

I cannot get the splash screen to work, all I get in the Xamarin default logo. This WAS working. All I did was update and now I cannot the image to appear at all. All my names are right. I dont understand

chrisweihu commented 3 years ago

Why is this ticket closed? The splash screen still not working for iOS 14

sisaacks commented 3 years ago

I used the MAC to create a new splash screen and imported into my project on the windows box. I had to change the image size in the Launchscreen.Storyboard to be smaller and then like magic the splash screen showed up. However, if I switch to the android project and back to IOS it doesn't work until I alter the image size again.

nhdanh commented 3 years ago

anyone has solution to fix this problem ? I still get this error on IOS 14 :(

mrwrighty commented 3 years ago

Used http://images.nativescript.rocks to create a new set of images but cannot get the splash screen to display for either Android or iOS. Android is blank white, iOS is blank black. All files copied to the relevant folders as explained on the website. Have restarted both Android and iOS emulators. Have done ns clean, have deleted and reinstalled the app on both platforms but still cannot get the splash working. iOS15, Android Oreo

sisaacks commented 3 years ago

Some people mentioned putting the image in the Resources file. How to you reference the image in the storyboard if its in the resources file? Can someone please post an example. I am so tired of IOS changing stuff.....

vhugogarcia commented 3 years ago

I'm facing the same exact issue. Anybody found a workaround?

sisaacks commented 3 years ago

@vhugogarcia the only thing I have found is to alter where the image is pointing in the LaunchScreen.storyboard. Essentially I added the image in the Resources folder and there are two places in the LaunchScreen.storyboard that point to where the image should be. Simply copy the name of the image you put in the resources folder to those locations.
One location should be under the "ImageView" tag in the storyboard and also the "Image" tag.

vhugogarcia commented 3 years ago

Thanks @sisaacks for your answer.

I just found the solution for my problem. Since I was using vector images on iOS (PDF files), when I enabled "Preserve vector data" checkbox the images were now showing correctly.

Thanks for sharing your solution it was also helpful!

sisaacks commented 3 years ago

@vhugogarcia I stand corrected....mine is no longer working again....IOS is INSANELY frustrating. I have two issues going on, one is the splashscreen not showing and the other is everytime I try to upload to transporter I get an error that the 1024x1024 app Icon is missing.....when its is NOT missing. I created a sample project and it worked with no issues. So frustrating.

I am also using a windows box not a MAC

sisaacks commented 3 years ago

Has anyone actually found what the issue is or what to do? I have an Xamarin Cross Platform app. I have a LaunchScreen.Storyboard which points to Launch Images in the Assets folders. Like everyone else....this was working.....but now it will not work at all.

sisaacks commented 3 years ago

@chamons Thanks, your solution worked.

Yes, this looks like a iOS 14 issue. Use image outside of Asset Catalog. Make sure image is not larger than 2400px.

What do you mean use an image outside of the Asset Catalog? Can you give an example?

sisaacks commented 3 years ago

So to all of you having this issue, this took me days to solve. My project was roughly 2.5 years old. I originally created my Storyboard 2.5 years ago. In the MS tutorial I followed it instructed me to put the Storyboard in the root folder of the IOS project. That worked flawlessly for 2 years. Then the splash screen sporadically started working then ultimately would not work.

I created a new Xamarin Flyout Application and noticed that there was a Storyboard in the resources folder. Hmmm? I ran the project and saw the same image I saw in mine. So I added my image to the project and referenced my image on the storyboard. Sure enough my image showed up.

I went back to my project, copied the XML on my storyboard, deleted it and added a new one by right clicking on the references folder, add new item and select Empty Storyboard. Paste your old storybaord XML in the empty storyboard. I ran the app....still didnt work...saw the blue screen yet again. I renamed the storyboard...and reselected it in the info.plist visual assets. Ran the app. It worked. Somehow there was a duplicate storyboard in my project that I could not see or find, I am not sure if it happened with the updates or what. I do know that when I originally created my project I dont recall a storyboard being in the resources folder.

sisaacks commented 3 years ago

I'm facing the same exact issue. Anybody found a workaround?

@vhugogarcia Look at my last reply

vhugogarcia commented 3 years ago

I'm facing the same exact issue. Anybody found a workaround?

@vhugogarcia Look at my last reply

Thank you!! That seems very very weird.

Glad you were able to solve it.

On my case the issue was just they I was forced to enable the preserve vector format on the image asset since my images are PDF files (vectors).

However, I did all you did as well and it was not duplicating it at all. All was fine.

Thanks again for sharing your workaround.

stevenbgoldmine commented 2 years ago

I had the issue where the storyboard background would display but not the image referenced by the LaunchScreen.storyboard. Interestingly the skeleton project created by Visual Studio 2022 also has this issue. Anyway I added the launch screen image to the Resources folder of my .iOS project and then edited the LaunchScreen.storyboard and changed the two occurrences of Icon-60.png to the name of my image.

Tronald commented 2 years ago

Super strange issue hitting me as well. I was able to get my issues solved(ish) with help in here. Issue occurred after editing Android launch screen, which is odd as nothing appears connected and edits are made in the specific platform project files.

  1. Uninstalled app from physical test device,
  2. Restarted physical test device.
  3. Rebuilt in iOS and it worked.

While the work around seems easy enough for testing, I have no idea if this could impact production builds silently.

sisaacks commented 2 years ago

For all of you facing this issue make sure you only have one storyboard and its in the resources folder. To check and see if you may have a duplicate file, as I did, rename the storybord and update the selection in the IOS properties. Clean your solution and rebuild.