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 8474027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:30:48+00:00 2026-06-10T17:30:48+00:00

AFNetworking default runLoopModes is NSRunLoopCommonModes.I want use NSDefaultRunLoopMode,and set it operation.runLoopModes = [NSSet setWithObject:NSDefaultRunLoopMode];

  • 0

AFNetworking default runLoopModes is NSRunLoopCommonModes.I want use NSDefaultRunLoopMode,and set it

 operation.runLoopModes = [NSSet setWithObject:NSDefaultRunLoopMode];

But it doesn’t work. when I scroll the scrollView,download task still running.
Anybody can help me? 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-06-10T17:30:50+00:00Added an answer on June 10, 2026 at 5:30 pm

    Recently I encountered similar question, while I was implementing images lazy loading in UITableView. User scrolling should have higher priority here.

    Your direction is correct, the problem is in runloop modes. With UIImageView+AFNetworking extension, images are loaded with AFURLConnectionOperation, which is working on a separate network thread (see implementation), so NSURLConnections are running not on main thread.

    To make the tasks stop when UITrackingRunLoopMode is active, you need to move networking code on main thread somehow.

    Possible solutions:

    1. Setup default runloop mode for your request operation.

      AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest];
      [requestOperation setRunLoopModes:[NSSet setWithObject:NSDefaultRunLoopMode]];
      
    2. Put connection on main thread (that’s ok, NSURLConnections are running their own threads): Find + (NSThread *)networkRequestThread and make it return [NSThread mainThread]. That might be not suitable with other situations, beware locks.

    I am still not sure why AFNetworking is creating it’s separate network thread. To process incoming data in background? If anybody have a guess, please reply.

    Also see this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code in ASIHTTP, but I want to move on AFNetworking. I
I want to use AFNetworking for a HTTP Post method with some parameters and
i wrote a .json file and want to download it with AFNetworking. But AFNetworking
I am trying to log into google reader using AfNetworking AfHttpClient but I am
AFNetworking + JSONKit + iOS 5.0+ = JSON parsing does not work (returns nil
I use AFNetworking in my app for every request (like login, get data from
I've just downloaded AFNetworking to try and mess with it, but i'm having weird
I'm learning to use AFNetworking . I know I can use AFHTTPClient for making
The documentation for AFNetworking notes that you should create subclass of AFHTTPClient and use
I am attempting to use AFNetworking with an XML-RPC based API while using GDataXML

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.