Skip to content

[Site Creation] Design View - UITableViewAlertForLayoutOutsideViewHierarchy warning #18514

Description

@twstokes

Expected behavior

UITableView should not try to lay out views before being in the view hierarchy.

Actual behavior

A warning is shown:

[TableView] Warning once only: UITableView was told to layout its visible cells and other contents without being in the view hierarchy (the table view or one of its superviews has not been added to a window). 
This may cause bugs by forcing views inside the table view to load and perform layout without accurate information (e.g. table view bounds, trait collection, layout margins, safe area insets, etc), and will also cause unnecessary performance overhead due to extra layout passes. 
Make a symbolic breakpoint at UITableViewAlertForLayoutOutsideViewHierarchy to catch this in the debugger and see what caused this to occur, so you can avoid this action altogether if possible, or defer it until the table view has been added to a window. 
Table view: <UITableView: 0x14fb77400; frame = (-207 -448; 414 896); gestureRecognizers = <NSArray: 0x28cc5b3b0>; layer = <CALayer: 0x28cce24e0>; contentOffset: {0, 0}; contentSize: {414, 44}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <WordPress.SiteDesignContentCollectionViewController: 0x16f815c00>>

Steps to reproduce the behavior

  1. Build the project in Xcode and start the app in Simulator or on a physical device
  2. In the app, create or log into a .com account
  3. Start the Site Creation flow (My Site -> tap down arrow at the top right -> tap + -> tap Create WordPress.com site)
  4. Navigate to the Design View and observe the target output

Set a symbolic breakpoint for UITableViewAlertForLayoutOutsideViewHierarchy to see the call stack.

Notes

  1. viewDidLoad() calls fetchSiteDesigns() here
  2. fetchSiteDesigns() sets isLoading here
  3. The isLoading setter calls tableView here
Tested on iPhone 13, iOS 15.4, WPiOS 19.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions