Designer visibility settings causing layout issues in iOS Companion App v2.60

Hi,

I'd like to report that there seems to be a conflict with the current iOS Companion App (v2.60) when running projects with hidden (non-visible) Layout component(s) configured in the Designer interface, causing the Companion App to crash during start-up, while it runs fine on Android. This has been observed on several iPhone / iPad devices running iOS 13.3 (from participants of the CoolThink workshop), and my own iOS 15.3.1 iPhone. Please kindly refer to the .aia project file and the video on the reported crash:

Lam_HoWai_AdditionGame_template.aia (121.2 KB)

iOS Companion App crashing immediately after launch with no error messages in App Inventor:

When the Layout component HorizontalArrangement2 was set to visible, the app was then able to launch fine on my iOS device.

Appreciate if this can be looked into. Many thanks! :pray: :pray:

p.s. Looping in @Anqi_Zhou as well

Cheers,
Ed

@Edward_Cheng Can you send me the project file? We can run some tests with debugging info turned on to narrow down the reason for the crash.

Hi @ewpatton,

Here's the project file. Many thanks!

Lam_HoWai_AdditionGame_template.aia (121.2 KB)

Cheers,
Ed

Hi @Edward_Cheng. I think I have a sense of why this is happening. I don't see it as a crash so much on our end but it does appear to get stuck in an infinite loop handling the sprite updates. I'm trying to work out the best course of action to fix it.

1 Like

Thanks @ewpatton, much appreciated. I have suggested the teachers to make the component visible for now if they would like to run the project on iOS devices.

So there's really two issues. The first issue is that when the visibility of the component is toggled in the designer, the layout gets compressed in an odd way. Interestingly, I can't seem to trigger it just using the blocks. When the layout gets messed up, the canvas shrinks in size to the point where it is just as tall as the sprites it contains. When this happens, the sprites always trigger the EdgeReached event, which calls NextQuestion, which redraws the sprites with new images, which immediately triggers the EdgeReached event. This is where the infinite loop originates.

A way I was able to fix it more generally was changing the EdgeReached event handlers:

blocks - 2022-08-15T171054.177

This checks that we are only triggering the next question when the sprite hits the rightmost edge of the canvas (versus the top).

However, I still need to debug the layout issue that happens when adjusting the designer visibility that cause the layout to go all funky.

Hi @ewpatton, thanks a lot for the explanation and the suggested workaround.

I've also tested another approach which seems to also work for the first issue (but not tested extensively) is by dragging the hidden component to the bottom of the screen below the canvas, such that the canvas layout will remain constant (assumingly) at the upper part of the screen.

RelocateHorizontalArrangement2

This seems to work on my iOS while keeping the HorizontalArrangement2 component hidden.

p.s. Renamed ticket to better reflect the issue.