Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有N个NSURLConnection落后,问题是我想NSURLConnection一起取消。NSURLConnection我知道我们可以一一取消
NSURLConnection
有什么帮助吗?
您可以将它们全部存储在一个NSArray中,然后遍历数组以取消每个。
NSArray
您可以NSOperationQueue通过将每个连接添加为NSOperation. 当您想停止所有连接时,您可以使用该cancelAllOperations方法终止队列。
NSOperationQueue
NSOperation
cancelAllOperations