"Close Screen" does not work with many blocks

Hello Community,

my aim is to draw a diagram after getting some input. (Up to now it is programmed vice versa, but never mind.) Not to create too many screens, I want to change to the original screen by "close screen" and not by "open another screen ...".
Attached you will find an example program, where some blocks are disabled. With the disabled blocks, the "close screen" works. If I enable all blocks, "close screen" will lead to a crash of the program. Changing the block "close screen" to "open another screen ..." at screen2 the program works perfectly. Therefore, the program itself seems to be correct.
I have the feeling, that after having a special number of blocks, the block "close screen" crashes. Do you have similar experiences or am I doing a mistake?
I look forward to your comments and ideas.


graphicTHG_test.aia (13.6 KB)

This (closeScreen on Screen2) doesn't work with Companion (only with the compiled app).
Try this:

1 Like

But do it only for testing with Companion. Otherwise the Screen1 is opened multiple times with the compiled app (or you must (also) close Screen1 when you switch to Screen2).

Hello Anke,

thanks for your suggestion. Your suggestion leads to a cresh again at my iPhone, also if several blocks are deactivated.
I think, I cannot compile the app because I am working on an iPhone. An apk can just be build for Android systems.


Oh I didn't realize it was about iOS.

Does anyboday has tested the program? And are there ideas, why the screen close command does not work with more than a specified number of blocks?
I look forward to your reply.

I believe that it is a race condition due to the fact that App Inventor tries to mimic multiple screens by passing information to/from the browser, which switches the active editor and sends the code to display the new screen. Because of the asynchronous nature of this operation, the browser update and the code running on the phone collide, resulting in one or more components being undefined or not ready for use. I will run some analysis on the project to see if we can mitigate the issue.


But I think it should work with the compiled app (ipa).
(Maybe I'll test it (with the ipa) in the next few days when I have time.)

Hello Anke,
is there a description, how to create an ipa for an iphone and how to run it? If so, I can also try to test it. But as far as I know, there is no possibility to create an app for the iphone.

Thanks for the information. And no, I really do not want to go through that procedure. Thanks.
So, I look forward to your testing.

Ok, and you can't (because you are not approved by MIT).