无法使用 StringLiteralConvertible 类型的参数列表调用 'init'

Cannot invoke 'init' with argument list of type StringLiteralConvertible

当我尝试运行下面的代码时出现此错误:

Cannot invoke 'init' with argument list of type (id:StringLiteralConvertible,host:Contact,target:Contact,text:StringLiteralConvertible)

我尝试在 class 中使用 NSString 和 String,但仍然遇到同样的问题。谁能指导我在这里缺少什么?

class Contact {
    let id:String? = ""
    let name:String? = ""
    var number:String? = ""
    var photoPath:String? = ""
    var onlineStatus:Bool? = false

    init(id:String,name:String) {
        self.id = id
        self.name = name
        self.number = ""
        self.photoPath = ""
        self.onlineStatus? = false
    }
}

class Message {
    var id:String?
    var time:NSDate?
    var host:Contact?
    var target:Contact?

    init(id:String,host:Contact,target:Contact,time:NSDate) {
        self.id = id
        self.host = host
        self.target = target
        self.time = time
    }
}

class TextMessage:Message {
    var text:String?

    init(id: String, host: Contact, target: Contact, time: NSDate, text: String) {
        super.init(id: id, host: host, target: target, time: time)
        self.text = text
    }
}

let host = Contact(id: "", name: "")
let target = Contact(id: "", name: "")
let msg = TextMessage(id: "", host: host, target: target, time: NSData(), text: "")

您在调用 TextMessage init 时得到了错误的数据类型,应该是 NSDate()

let msg = TextMessage(id: "", host: host, target: target, time: NSDate(), text: "")