Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6969057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:31:57+00:00 2026-05-27T16:31:57+00:00

In my iPhone app I’m using a 3rd party library (libPusher) for WebSockets networking

  • 0

In my iPhone app I’m using a 3rd party library (libPusher) for WebSockets networking and this library causes every UIScrollView component in my app to become unresponsive. This includes UIScrollViews and UITableView.

What happens is that if a user scrolls one of the UIScrollView components with his finger and happens to keep touching and sliding the view with his finger at the same time that a network operation is under way, then this leads to a completely unresponsive UIScrollView that stops accepting touch events (it thinks that it’s in a drag mode all the time even when the finger is lift) and does not decelerate appropriately. The only way out is to destroy the UIScrollView and recreate a new one.

I have contacted the developer of the library but unfortunately so far haven’t heard back.

From what I read, this is a common problem when running a run-loop in an un-appropriate mode such as NSDefaultRunLoopMode, however this library seems to be doing the right thing and it runs its run loop in NSRunLoopCommonModes so I’m unclear as what the right solution is.

I tried playing with different modes (tried NSDefaultRunLoopMode) but the behavior is the same.

I’m using iOS 5 and it’s the same behavior on the simulator as well as on devices.

Let me paste the code which I think is problematic in the lib and hopefully that’d be enough scope to let you help me find a solution.

In a subclass of NSOperation 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]; 
  }

  // Common modes instead of default so it won't stall uiscrollview scrolling
  [URLConnection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
  [URLConnection start];

  do {
    [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
  } while (!_isFinished);
}

This operation runs on the main thread, as in [[NSOperationQueue mainQueue] addOperation:authOperation];. (maybe this is the problem, but I tried running it in another thread and it crashes so the library will need more work to make it background-thread safe so I can’t prove yet that this is the solution…)

So far I tried

  • changing the run loop mode to NSDefaultRunLoopMode – didn’t help.
  • running the operation in a new operation queue that I created (e.g. not on the main thread) but the library doesn’t seem to be ready for this as it crashes.

I still feel like I’m shooting in the dark… help 🙂

thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:31:58+00:00Added an answer on May 27, 2026 at 4:31 pm

    It’s becoming unresponsive since it’s doing a while loop on the main thread. This a bad design pattern.

    Since you’re on iOS5, why not use NSURLConnection’s +sendAsynchronousRequest:queue:completionHandler: ?

    If you need to be compatible for iOS4.x I would strip out the run loop stuff and take a look at this blog post.

    Basically, I would do something like this:

    - (void)start
    {
        if (![NSThread isMainThread]) {
            return [self performSelectorOnMainThread:@selector(start) 
                                          withObject:nil
                                       waitUntilDone:NO];
        }
    
        [self willChangeValueForKey:@"isExecuting"];
        isExecuting = YES;
        [self didChangeValueForKey:@"isExecuting"];
    
        NSURLConnection *aConnection = [[NSURLConnection alloc] initWithRequest:request 
                                                                       delegate:self];
    
        self.connection = aConnection;
        [aConnection release];
    
        if (connection == nil) {
            // finish up here
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The iPhone app that I am working on requires GET calls to a 3rd
My iPhone app started logging this error: lo->hi recycling invariant violated! followed by: Program
My iPhone app formats an NSDecimalNumber as a currency using setCurrencyCode, however another screen
my iphone app is using soap web-services. I want to know how it would
In iPhone App i am using core Plot vertical bar chart. How to Remove
My iPhone app was running fine. I added a component to my xib file
My iphone app occasionally crashes on the simulator and device with this message in
My iPhone app is using encrypted assets. The decryption key will need to be
My iPhone app is using the MFMailComposeViewController class to send an in-app email with
my iphone app crashes unexpectedly and looking at the crash log I can't tell

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.