Error: UICollectionView must be initialized with a non-nil layout parameter

前端 未结 2 854
隐瞒了意图╮
隐瞒了意图╮ 2020-12-20 17:54

I am trying to create a Facebook messenger like application from a youtube tutorial. I have a home page where the user click BarButton to open the chats. The Home page works

2条回答
  •  渐次进展
    2020-12-20 18:35

    Seems like you skipped steps in a tutorial which is using Interface Builder.

    The problem is, that in your ChatViewController there is a missing connection between your "collectionView?" and the corresponding UICollectionView (so called referencing outlet) in the Interface Builder.

    This is a very basic task in iOS development. Please have a look at the official Apple documentation under the topic "Create Outlets for UI Elements": Connect UI to Code

提交回复
热议问题