Blank screen after switching screens

Yes, with the compiled app (APK), but not with Companion.

With companion. On Android. The logic of both aia above works the same. Screen2 is displayed after clicking on calculate. For me, I can switch screens manually in the designer using the screen selection button, but the author gets an error at this point. But in my example aia which is somewhere above "start value" screen2 switches without problems.

Interesting, this is actually new to me. Since when does this work with Companion?

I've been building apps in ai2 for several years. I think about 5 years, and I don't think I've ever had a problem with it... although I remember that it used to be said that you shouldn't close the screen1.

I close Screen1 in almost all my apps and reopen it when I return to it from another screen.

Me too. But in any case, for the author of the topic, no way works. What is strange.

Try this one:
openScreen.aia (4.6 KB)

It seems to work on a iPhone 6s (iOS 15.73).
(I'll update...)

Screen1

Screen2

Hi, I recorded some footage of some testing I did using your project. It seems that the screens are loading propperly. However, a certain path of buttons crashed the app, I am not really sure why. The following file is a recording I did on my phone (Iphone X iOS 16.1.2):

Note: Switching Screens with Companion
If you switch from Screen1 to Screen2 (with my test app) while Screen1 is being closed and then click the CloseScreen button on Screen2, the app will also return to Screen1, even though that screen was actually closed.

This means that closing a screen (except for Screen1) always causes Screen1 to be reopened. In other words, switching screens with Companion doesn't make sense and you don't learn anything from it.

But it doesn't change anything and doesn't add to the problem that occurs here.
As described in this thread, projects with both screen switching methods crash, so that's not the problem here.

However, for me on android all projects work fine and there is no "blank screen" when switching them. So either there is something wrong with companion for ios or something wrong with this project that companion ios is allergic to.

As I said before, it doesn't matter if it works with Companion or not. You have to test it with the compiled app. This is the only way.

Maybe I'll test it later with a compiled ad hoc version (IPA). However, it's always a big deal for a small cause.

So explain to us why the project works fine for me in companion and not for him...
Why your test project works fine and changes screens for him. Why my test project "start value" also works fine for him and opens screen2. In contrast, its project does not open screen2. In my opinion, switching screens was never a problem in the companion, it always worked.

There is a known bug we're trying to track down involving screen switching with values on iOS. I was able to replicate the problem but even with additional debugging turned on I have yet to determine why this project fails to switch screens correctly. The code comes over from App Inventor just fine but it may be failing in the initialization step, which would actual create the UI and then run Screen2's Initialize event.

Hello Leo

So, as per my link, App Inventor has a Screen Switching problem on iOS, you cannot switch screens with a Start Value.

All is not lost though:

  1. You can save the value to TinyDb in Screen1, then read that value in Screen2

OR

  1. You can use Virtual Screens instead, as most of us do:

When we define virtual screens, we use one 'real' App Inventor Screen (most often Screen1). Screen-sized Vertical Arrangements on it are displayed/hidden as required - they are the Virtual Screens. This is generally a better approach for multi-screen Apps, they share data without having to "pass" it between screens and it also reduces code duplication, making the App more efficient and the code easier to follow if you have to return to it at a later date.
So, instead of separate "houses", virtual screens are "rooms" of the same "house".

Actually, the bug was more subtle than that. We do have a potential fix available in beta via TestFlight:

In general, switching screens with the start value works, because my test aia indicate it. The start value has been correctly transferred to screen2. There must be more to what was in his project.

..... Did you test it on iOS Patryk?

The test was here:

As you can see my simple project with 2 screens worked for him. The author of the topic opened screen2 with a starting value of 12345.

As you can see the screen2 is not blank, the labels show up and one of them is filled with the starting value.

The error occurs but simple apps do not show it. There must be something that when added to the app makes the problem worse. Maybe a third screen?

... actually I suspect it might be float values, but Evan has not revealed the cause.

1 Like

This version works without issues on my test device (iPhone 6s, iOS 15.75)
CALCULADOR_IMC_1_copy.aia (74.8 KB).

But you cannot switch to (open) Screen1 manually from Screen2 by clicking here:
grafik

Then you get this error:


After dismissing error you must reload Screen1.