Skeletonview: iOS 13 New tableView logic

Created on 24 Sep 2019  路  7Comments  路  Source: Juanpe/SkeletonView

鈿狅笍 Please fill out this template when filing an issue.

馃檹馃徏 Please check if it already exists other issue related with yours.

What did you do?

Build and run app with iOS 13

What did you expect to happen?

Skeleton to work as intended and displaying skeleton

What happened instead?

Skeleton did not appear and several warnings appeared on debug

Steps to reproduce the behavior

Simply run the app

SkeletonView Environment

SkeletonView version: 1.7 ~ 1.8.2
Xcode version: 11.1
Swift version: 5.1

I get this warning: [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: 0x136841c00; frame = (-187.5 -406; 375 812); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x281dfc240>; layer = <CALayer: 0x281382340>; contentOffset: {0, 0}; contentSize: {375, 0}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <RxSkeleton.RxTableViewSkeletonedDataSourceProxy: 0x2838a5f10>>

Also, when opening other screens, more warnings appear:

[Assert] Attempted to access the table view's visibleCells while they were in the process of being updated, which is not allowed. Make a symbolic breakpoint at UITableViewAlertForVisibleCellsAccessDuringUpdate to catch this in the debugger and see what caused this to occur. Perhaps you are trying to ask the table view for the visible cells from inside a table view callback about a specific row? Table view: <UITableView: 0x136841c00; frame = (0 0; 375 641); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x281dfc240>; layer = <CALayer: 0x281382340>; contentOffset: {0, 0}; contentSize: {375, 750}; adjustedContentInset: {0, 0, 0, 0}; dataSource: <SkeletonView.SkeletonCollectionDataSource: 0x281d36760>>

For what i can tell, iOS 13 added a few changes to the tableView. Unfortunately i don't have the time to debug and see what is exactly happening.

It works as intended if i add a 0.1 delay to my API request, so it doesn't overlap with the skeleton showing up. It looks like now you can't simply throw everything to the tableView and expect it to work. So if your request returns very fast, you have to wait a bit until the tableview has completed it's job of rendering all cells. What a bummer.

Has anyone any idea how to deal with this?

馃悶 bug

Most helpful comment

According to the Apple Developer Forum answer you have to show the skeleton in the viewDidLayoutSubviews method. Check my PR #198 , where I fixed this warning in the example project.

All 7 comments

According to the Apple Developer Forum answer you have to show the skeleton in the viewDidLayoutSubviews method. Check my PR #198 , where I fixed this warning in the example project.

馃憢 I've stumbled upon exactly the same issue. Has anybody figured out a different solution for this?

    private var didShow = false
    override func viewDidLayoutSubviews() {
        if didShow { return }
        didShow = true
        tableView.showAnimatedSkeleton()
    }
#0  0x00007fff4775759a in UITableViewAlertForVisibleCellsAccessDuringUpdate ()
#1  0x00007fff47757511 in -[UITableView _visibleCellsUsingPresentationValues:] ()
#2  0x0000000103573723 in UITableView.subviewsToSkeleton.getter ()
#3  0x00000001035736b5 in @objc UITableView.subviewsToSkeleton.getter ()
#4  0x0000000103573396 in UIView.subviewsSkeletonables.getter ()
#5  0x0000000103573315 in @objc UIView.subviewsSkeletonables.getter ()
#6  0x0000000103580ff6 in UIView.isSkeletonActive.getter ()
#7  0x00000001035647d4 in SkeletonCollectionDataSource.skeletonCellIfContainerSkeletonIsActive(container:cell:) at Pods/SkeletonView/Sources/Collections/SkeletonCollectionDataSource.swift:77
#8  0x00000001035646c5 in SkeletonCollectionDataSource.tableView(_:cellForRowAt:) at Pods/SkeletonView/Sources/Collections/SkeletonCollectionDataSource.swift:39
#9  0x0000000103564915 in @objc SkeletonCollectionDataSource.tableView(_:cellForRowAt:) ()
#10 0x00007fff47778d93 in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] ()
#11 0x00007fff4774210c in -[UITableView _updateVisibleCellsNow:] ()
#12 0x00007fff477574f2 in -[UITableView _visibleCellsUsingPresentationValues:] ()
#13 0x0000000103573723 in UITableView.subviewsToSkeleton.getter ()
#14 0x00000001035736b5 in @objc UITableView.subviewsToSkeleton.getter ()
#15 0x0000000103573396 in UIView.subviewsSkeletonables.getter ()
#16 0x0000000103573315 in @objc UIView.subviewsSkeletonables.getter ()
#17 0x00000001035714fa in UIView.recursiveShowSkeleton(skeletonConfig:root:) ()
#18 0x00000001035719e3 in closure #2 in UIView.recursiveShowSkeleton(skeletonConfig:root:) ()
#19 0x00000001035710cf in thunk for @callee_guaranteed (@guaranteed UIView) -> () ()
#20 0x000000010355f3fe in closure #1 in Array<A>.recursiveSearch(leafBlock:recursiveBlock:) at Pods/SkeletonView/Sources/Helpers/RecursiveProtocol.swift:24
#21 0x00007fff50e6b024 in Sequence.forEach(_:) ()
#22 0x000000010355f350 in Array<A>.recursiveSearch(leafBlock:recursiveBlock:) at Pods/SkeletonView/Sources/Helpers/RecursiveProtocol.swift:24
#23 0x000000010357167b in UIView.recursiveShowSkeleton(skeletonConfig:root:) ()
#24 0x000000010356f9ff in UIView.showSkeleton(skeletonConfig:) ()
#25 0x000000010356fcdb in UIView.showAnimatedSkeleton(usingColor:animation:transition:) ()
#26 0x00000001028e171e in BookingFilterSelectorViewController.viewDidLayoutSubviews() at BookingFilterSelectorViewController.swift:151

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

TableView.zip

@Juanpe I make a demo project

Thanks @gloryluu for the example. I will check this bug as soon as possible :)

@Juanpe If its useful, I confirmed that the workaround that @Levivig used in his example worked for me as well. Here's a link to his code again which may help suggest a solution: https://github.com/Juanpe/SkeletonView/pull/198/files#diff-6c59b1dd1e6e1989f714b8f19ea1d730

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Manikandan271192 picture Manikandan271192  路  4Comments

Erumaru picture Erumaru  路  7Comments

raphaklr picture raphaklr  路  5Comments

adelbios picture adelbios  路  4Comments

adelbios picture adelbios  路  6Comments