开发者

Connection notification to resume NSOperationQueue

开发者 https://www.devze.com 2023-03-01 06:33 出处:网络
I need to download some images from the Internet and right now I\'m using NSOperationQueue. I want to know if it is possible to receive an Internet connection notification to be able to pause/resume

I need to download some images from the Internet and right now I'm using NSOperationQueue.

I want to know if it is possible to receive an Internet connection notification to be able to pause/resume the download.

I don't need to freeze the download, but just being able to put it (the NSOperation) back on the queue and wait for connection to start it again would be开发者_Python百科 awesome.

Any ideas? :)


After checking for reachability, you can set the NSOperationQueue length to 0 if it's not reachable. That way you can effectively pause it.


See this link for further help. You could use the code with apple documentation listed. WAN detection and airport detection is shown in the code. http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号