Black flash on transition to foreground

@bgmadclown you can check it out in Designer City 2 by @anon63346430.
And on the contrary, I wondered why no one had commented on this matter.
I’ve been talking about this since last year, but if you look at @Edissey’s video, can’t you clearly see the problem?

In the video, The left is a game made by @anon63346430 with Corona, and the right is a game made with Unity.

@bgmadclown @SUPER_TOKI
Not seeing anything in the video. All I see is a blank screen.
AND just like that it has appeared :slight_smile:

I forgot to correct myself earlier, sorry about that. After looking at it a few more times I realized this was a thing. Most developers probably think it’s not that big of a deal. I haven’t realized the transition until I saw this thread :slight_smile:

@Edissey Attached the video again.

@SUPER_TOKI Yes, I saw it. So, now we all agree this does exist. Not sure if and when anything will ever be done about it.

@vlads @Edissey One more thing, if the overall game color of Designer City2 by @anon63346430 is the color that turns the Home Indicator to black, a black screen may cause the problem below.

I still experience this.

After a brief conversation and testing with @vlads.
This problem can certainly be solved with METAL. The good news is that vlad is finally touching METAL. In 2020.3612 (Metal Alpha) and later versions this issue is resolved.

We have the same problem. When our app returns from the background it fades in a black screen on top of our content. Then the black screen disappears. This looks totally glitchy.

We are using Solar2D version 3617. As @SUPER_TOKI said, the problem is resolved only if you build with Metal. But, we won’t be using METAL. Our app is built natively via Xcode and as far as I know, Metal is not yet ready for native builds.

We never had such a problem with any of our apps in the past. Has anyone found a solution (other than building with Metal)? @vlads are you aware of this problem?

Trying to debug this problem for days now. We started stripping down our app to the point that we only had main.lua creating a simple rectangle. The problem with the black screen persisted.

Then we built one of Corona’s sample projects (HorseAnimation). Same issue.

We build with Corona Simulator 3621 and iOS14 (not Metal). If we build with Metal everything is good. But, as I said, our final app will be built natively, so we can’t use Metal.

Here are two video captures that show how the app behaves when coming to the foreground, with Metal and not Metal. It may seem as a minor glitch to some, but not for us. It makes our app look unprofessional and we just cannot accept it. Our app launches in November. @vlads can you please help?

I would advise on using metal anyway. You can find libtemplate for metal inside Resources/iostemplates inside CoronaSimulator.app

This is our first app built natively and we are still struggling with Xcode. Is this the folder you are referring to? And what should we do exactly?

Screenshot 2020-10-24 at 12.39.55 PM

Is it the “iphoneos_14.0-angle” archive? How do we use this in Xcode?

Screenshot 2020-10-24 at 6.24.55 PM

Hello! Sorry for the delay. If everything goes according to plan, 3624 would have libplayer-angle and MetalANGLE frameworks. To integrate those, you would have to change your native app slightly. Here is a link to the the change of the template app:

Basically change is 3 step:

  1. Add "$(CORONA_ROOT)/Corona/ios/lib" into FRAMEWORK_SEARCH_PATHS in CoronaNative.xcconfig
  2. In CoronaApp.xcconfig change -lplayer into -lplayer-angle
  3. In Finder navigate to the Applications -> Corona-2020.xxxx -> Native -> Corona -> ios -> lib, and drag&drop list MetalANGLE.framework into Xcode’s framework list in your app. Make sure “Embed&Sign” is selected

That should be it. Also, don’t forget to call Setup Corona Native on your new version of Solar2D.

Thank you @vlads, it works perfectly and the black flashing issue is fixed. :+1:
What is the minimum iOS deployment target when using Metal?

I think it should be 8.0, but currently minimum build is 9.0 for Xcode 12. Pretty sure 9.0 is safe. I didn’t test, because I don’t have any devices with that iOS. If you could test and get back to me, it would be great.

I can probably test on a device with iOS 10. I will let you know if I do. Thanks!

Unfortunately, we are unable to distribute the release version of our app using Metal. Build and Archive succeed but distribution fails with the following messages:

The following issues occurred while distributing your application:

App Store Connect Operation Error
ERROR ITMS-90087: “Unsupported Architectures. The executable for appName.app/Frameworks/MetalANGLE.framework contains unsupported architectures ‘[i386, x86_64]’

App Store Connect Operation Error
ERROR ITMS-90125: “The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple’s linker.”

@vlads can you have a look at this?

Also, regarding the iOS target, we were unable to archive our app using deployment target 9.0. We got this error:

clang: error: no such file or directory: ‘/Users/elpida/Library/Developer/Xcode/DerivedData/App-coaafjxlolkokpatyvwyzqbmzxes/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/libplugin_library.a’
command ld failed with a nonzero exit code

So, we switched to target 12.0 and we were able to archive. (The distribution errors in my previous message are with deployment target 12.0)

This is weird, since we’re linking using target 9.0 without issues… Error you’re showing is not about code in Solar2D, probably something in your project setup. Make sure to change deployment for both main app project and plugin one.
Are you using some other 3rd party dependencies?

About Unsupported Architectures, this can help, leaving only arm architectures:

cd "$HOME/Library/Application Support/Corona/Native/Corona/ios/lib/MetalANGLE.framework"
cp MetalANGLE ../
lipo -remove i386 -remove x86_64 ../MetalANGLE -o MetalANGLE