question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS: App freezes after switching content

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
freakboy3742commented, Jun 22, 2021

@calvma toga.platform.current_platform contains the currently active platform (as a string; you’re looking for iOS in this case).

1reaction
t-arncommented, Feb 10, 2021

@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:

2021-02-10 08:00:53.874 5279-5279/com.t_arn.demoapp E/Python: Traceback (most recent call last):
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:   File "/data/user/0/com.t_arn.demoapp/files/python/user_code/app_packages/rubicon/java/api.py", line 44, in dispatch
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:     val = getattr(pyinstance, method)(*args)
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:   File "/data/user/0/com.t_arn.demoapp/files/python/user_code/app_packages/toga_android/widgets/button.py", line 14, in onClick
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:     self.button_impl.interface.on_press(widget=self.button_impl.interface)
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:   File "/data/user/0/com.t_arn.demoapp/files/python/user_code/app_packages/toga/handlers.py", line 55, in _handler
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:     result = handler(interface, *args, **kwargs)
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:   File "/data/user/0/com.t_arn.demoapp/files/python/user_code/app/demoapp/app.py", line 39, in handle_btn_goto1
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:     self.box.remove(self.box.children[0])
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:   File "/data/user/0/com.t_arn.demoapp/files/python/user_code/app_packages/toga/widgets/base.py", line 135, in remove
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python:     self._impl.remove_child(child._impl)
2021-02-10 08:00:53.875 5279-5279/com.t_arn.demoapp E/Python: AttributeError: 'Box' object has no attribute 'remove_child'

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'

Read more comments on GitHub >

github_iconTop Results From Across the Web

My Apps keep Freezing After Update to iOS 16/15, How to Fix
Part 1: Top 7 Solutions to Fix My Apps Keep Freezing or Can't Move After iOS 16/15 Update · Solution 1: Use Tenorshare...
Read more >
Iphone freezes intermittently and between switching apps
Hello, I have an XR and when switching between apps, the screen freezes and either it returns to the one app and logs...
Read more >
6 Methods to fix iPhone, iPad Apps Freezing and Crashing
Ways to fix iPhone, iPad apps freezing and crashing or quitting unexpectedly · Approach 1: Follow the 3 R? · Reset iPhone to...
Read more >
How to fix apps that keep freezing, closing unexpectedly on ...
First solution: End all background apps then restart your iPhone XS Max. · Go to the Home screen then swipe your finger up...
Read more >
App Switcher Freezes, Won't Respond, Unable to Close Apps ...
The first step I recommend for you is to ensure that your iPhone or iPad is up to date. Update your device to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found