UITableViewAlertForLayoutOutsideViewHierarchy error: Warning once only (iOS 13 GM)

前端 未结 10 755
说谎
说谎 2020-12-25 12:23

I am getting a strange error with iOS13 when performing a Segue and I can\'t figure out what it means, nor can I find any documentation for this error. The problem is that t

10条回答
  •  误落风尘
    2020-12-25 12:40

    I am getting similar breakpoint with SwiftUI, without even dealing with viewDidLoad or viewDidappear

        //
    //  ContentView.swift
    //  DD
    //
    //  Created by Roman Emperor on 3/29/20.
    //  Copyright © 2020 Emperors. All rights reserved.
    //
    import Combine
    import SwiftUI
    
    // Defining a class Booking of type Bindable Object [changed to ObservableObject]
    class Booking: ObservableObject {
        var didChange = PassthroughSubject()
    
        // Array of types to work with
        static let types = ["Consultation", "Tooth Pain", "Cleaning", "Brases", "Dental Implant" ]
        // Setting instance varibale type
        var type = 0 { didSet { update() } }
    
        func update () {
            didChange.send(())
        }
    }
    
    
    struct ContentView: View {
        @ObservedObject var booking = Booking() //bindableObject in old swift version
    
        var body: some View {
            NavigationView {
                Form {
                    Section {
                        Picker(selection: $booking.type, label: Text("Select a Booking Type")) {
                            ForEach(0 ..< Booking.types.count){
                                Text(Booking.types[$0]).tag($0)
                            }
                        }
                    }
                }
            .navigationBarTitle(Text("Darpan Dental Home"))
            }
        }
    }
    
    
    struct ContentView_Previews: PreviewProvider {
        static var previews: some View {
            ContentView()
        }
    }
    

    The Complete output Log is here:

    *> 2020-03-29 09:22:09.626082+0545 DD[1840:76404] [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.*

    **where is this UITableViewAlertForLayoutOutsideViewHierarchy in SwiftUI ? **

提交回复
热议问题