I can't see the pictures which are in image sprites in canvas when I use I-Phone(I can see when I use Android) #mit-app-inventor-help

Pictures in image sprites in canvas doesn't work in IPhone MIT App Inventor Help

Do you have an example project that doesn't work on iOS that you can share here? Someone should be able to take a look to understand what is going on.

No problem here with two test devices (iPhone 6s & iPhone 15 Pro Max).

I am facing this issue (and did not see new update regarding this pb)

Sprite Image not displayed in Canvas on iPhone and iPad: OK with companion, but fail with .ipa built app.

Here is my test app: Test_Image_Sprite.aia (58.5 KB)

I have tested with iPhone Xs Max running iOS 18.5 and iPad Pro iPadOS 16.7.10

Note: I notices that image randomly show-up if closing / opening the app ???

Try this one:
Test_Image_Sprite2.aia (58.5 KB)

On my iPone, with built app (.ipa) with your version, the first time when the app is run, the image is displayed in a very small square at the top corner:

If closed and re-open it is properly displayed

What did you change?

With my version, first time, no image, than when closed / opened, sometimes it is displayed OK, sometimes not ...

There is some random behaviour ...

I checked it only with Companion. For the IPA try this (TimerIntervall = 100):

grafik

Thanks a lot Anke. This is working.

Actually, my goal was to be able to display an image keeping the correct aspect ratio (NO distortion). I found the blog: Background picture lock ratio: Background picture lock ratio - #96 by TIMAI2 and started from it. This solution is using canvas and sprite, and that's why I was facing issue displaying sprites on iOS.

Finally, based on @TIMAI2 greenCircleUniversalDemo.aia I found a cleaner solution (without using canvas & sprite) for keeping correct aspect ratio for general purpose (not for background), using the webwiever and html file to get picture aspect ratio, and comparing this AR to the image container AR (working for Android AND iOS)

Here is my solution:

and the aia:
GoodAspectRatio.aia (123.5 KB)

Should I post this solution demo somewhere to share it with App Inventor community? @Anke @TIMAI2 @ewpatton

I think this is a bug in the logic of the compiled app framework. In the companion, a reset call is done before every screen is rendered. This ensures the screen is clean from previous projects/screens, but likely resets some variables that aren't being reset in packaged apps. I'll need to run some tests.