Cannot invoke initializer for type 'AnyObject?

2020-05-06 03:02发布

问题:

I am using swift 3 to build a type of chat messenger. To store loggedIn Users, I try to use an onject of type AnyObject.

    var loggedInUser = AnyObject?()

And it gives the following error: ViewController.swift:29:24: Cannot invoke initializer for type 'AnyObject?' with no arguments