NSURLRequest won't fire while UIScrollView is scrolling

前端 未结 2 1864
猫巷女王i
猫巷女王i 2020-12-28 08:39

I have a problem in that I am trying to background load a sound file while the user moves around a UIScrollView... The problem is that I am using NSURLRequest so I can load

2条回答
  •  佛祖请我去吃肉
    2020-12-28 09:20

    I've figured out the hard way that if you call startImmediately:YES or ommit this parameter second line is completely useless. So be sure to follow the exact pattern provided by @tidwall.

    Here's also a swift example:

    self.connection = NSURLConnection(request: self.request, delegate: self, startImmediately:false)
    self.connection?.scheduleInRunLoop(NSRunLoop.currentRunLoop(), forMode: NSRunLoopCommonModes)
    self.connection?.start()
    

提交回复
热议问题