[英]How to access NSURLConnection Delegate property
Why is it not possible to do the following: 为什么无法执行以下操作:
id connectionDelegate = myConnection.delegate;
//myConnection is an instance of NSURLConnection
Why is this not possible, and how do I access the delegate otherwise. 为什么这不可能,否则我将如何访问委托。 Seems rather awkward to me, or am I missing something here? 对我来说似乎很尴尬,还是我在这里想念什么?
NSURLConnection is pretty awkward. NSURLConnection非常尴尬。 Why are you still using it? 您为什么仍在使用它? Unless you're trying to maintain backwards compatibility with iOS 6 or OS X v10.8 and earlier, just use NSURLSession. 除非您尝试保持与iOS 6或OS X v10.8及更早版本的向后兼容性,否则请使用NSURLSession。
With that said, if you must keep using that API for backwards compatibility, you can always do what I've done in these situations: 话虽如此,如果您必须继续使用该API来实现向后兼容性,那么在这些情况下,您始终可以做我所做的事情:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.