iOS: App freezes after switching content
See original GitHub issueI’m trying to create a mobile app with more than just 1 page.
For Android, this works fine by replacing the content of the main window:
self.app.main_window.content = new_main_box
It also works on macOS.
On iOS, the new_main_box is also shown, but then, the UI is completely unresponsive. No button is working, no input field is taking the focus, nothing works anymore and I have to kill the app to get out of this screen. There is no error in the logs, so I have no idea what the problem might be.
I made a minimal demo app to show this problem: https://bitbucket.org/TomArn/demoapp.git branch: iOS_content_switching In this demo app, in addition to the above problem, the new screen is black and I only see the button, but not the label, whereas in the other app where I first found the problem, the screen actually looked pretty OK (except that it was frozen…)
I’m using Python 3.8 on iOS 14.4, Toga 0.3.0dev27
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
@calvma
toga.platform.current_platform
contains the currently active platform (as a string; you’re looking foriOS
in this case).@mshammel Many thanks for your workaround! I can confirm that it is working on iOS 😃 The workaround is now also in the repo, in the branch iOS_content_switching_workaround
I also tested the workaround on Android, but there, I get an error, because Widget.remove() is not implemented there:
So, unfortunately, your workaround does not cover both mobile platforms, which means that in my app code I would need to treat iOS specifically with
if platform == 'iOS'