如果我使用以下代码,它会显示错误
“键入’HttpConnection’不符合协议’NSObjectProtocol’”
原文链接:/swift/318803.html“键入’HttpConnection’不符合协议’NSObjectProtocol’”
class HttpConnection : NSURLConnectionDataDelegate { var urlConnection : NSURLConnection? weak var delegate : HttpConnecting? init(delegate:HttpConnecting){ self.delegate = delegate; } func startAsynRequestWithUrlString(url:NSString,withMethod:NSString){ } }
如果我将HttpConnection子类化为NSObject,那么它工作正常.所以我的问题是当我需要采用NSURLConnectionDataDelegate协议在swift为什么我需要从NSObject继承类?