In my iPhone application, I use a third-party library (libPusher) for the WebSockets network, and this library causes each UIScrollView component in my application to stop responding. This includes UIScrollViews and UITableView.
What happens if a user scrolls one of the UIScrollView components with his finger and, as a rule, continues to touch and move the view with his finger at the same time that the network operation is performed, this leads to a completely irresponsible UIScrollView that stops receiving touch events (he thinks that he is in drag mode all the time, even when lifting his finger) and does not slow down properly. The only way out is to destroy the UIScrollView and recreate a new one.
I contacted the developer of the library, but, unfortunately, still have not heard back.
From what I read, this is a common problem when starting a startup loop in unacceptable mode, like NSDefaultRunLoopMode , however this library seems to be doing the right thing and starting the execution loop in NSRunLoopCommonModes so I don't understand how it is right.
I tried playing in different modes (tried NSDefaultRunLoopMode ), but everything is the same.
I am using iOS 5 and this is the same behavior on the simulator as well as on the devices.
Let me paste some code that I think is problematic in lib, and hopefully this will be enough features so you can help me find a solution.
In the NSOperation subclass, we have:
- (void)start { NSAssert(URLRequest, @"Cannot start URLRequestOperation without a NSURLRequest."); [self setExecuting:YES]; URLConnection = [[NSURLConnection alloc] initWithRequest:URLRequest delegate:self startImmediately:NO]; if (URLConnection == nil) { [self setFinished:YES]; }
This operation is performed in the main thread, as in [[NSOperationQueue mainQueue] addOperation:authOperation]; . (maybe this is a problem, but I tried to run it in a different thread, and it will work, so the library will need more work to make it background so that I cannot prove that this solution ...)
So far i tried
- changing the run cycle mode to
NSDefaultRunLoopMode - did not help. - starting the operation in a new work queue that I created (for example, not in the main thread), but the library does not seem to be ready for this, since it will work.
I still feel like shooting in the dark ... help :)
thanks!