我正在尝试在Swift中创建自定义消息媒体数据,但它一直告诉我:
type 'CustomMedia' does not conform to protocol 'NSObjectProtocol'
即使我已经实现了所有协议方法。缺少什么?
class CustomMedia: JSQMessageMediaData {
@objc func mediaView() -> UIView! {
let mediaView = UIView()
let label = UILabel(frame: CGRectMake(0, 0, 200, 21))
label.center = CGPointMake(160, 284)
label.textAlignment = NSTextAlignment.Center
label.text = "I'am a test label"
mediaView.addSubview(label)
return mediaView
}
@objc func mediaViewDisplaySize() -> CGSize {
let size = CGSizeMake(200, 21)
return size
}
@objc func mediaPlaceholderView() -> UIView! {
return nil
}
@objc func mediaHash() -> UInt {
return UInt(0)
}
}