wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.66k stars 1.11k forks source link

App crashes on iPad after deleting the last site #21473

Open crazytonyli opened 1 year ago

crazytonyli commented 1 year ago

Steps to reproduce the behavior

  1. Prepare a WP.com account that only has one blog.
  2. Set the iPad at landscape mode.
  3. Open Jetpack/WordPress app on the iPad.
  4. Open Photos app on the iPad too, and make sure the two apps are not in a split view.
  5. Go back to the Jetpack app, sign in using the WP.com account prepared in step 1
  6. Delete the one and only site in the account: My Sites -> Menu -> Delete Site, and delete the site.
  7. The app now shows a "No Sites" view which has an "Add new site" button.
  8. Put the Jetpack/WordPress app into split view by dragging down the "..." split view indicator thingy and launch the Photos app.
  9. Now the iPad should show Jetpack/WordPress app and the Photos app side by side.
  10. Drag the split view indicator to make Jetpack/WordPress app smaller or larger. There are two potential outcomes:
    • The app crashes immediately. Or
    • The app shows a blog details view where it has a "Remove Site" button. Click the "Remote Site" button will cause the app to crash.
Tested on [device], iOS [version], Jetpack iOS / WordPress iOS [version]

v23.0

crazytonyli commented 1 year ago

The root cause is iPad trait collection change leads to MySitesViewController responds to iPad's trait collection change notification and uses the deleted Blog instance (i.e. querying it in database, making API calls, presenting it on screen, etc).