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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:21:57+00:00 2026-06-06T18:21:57+00:00

I am creating an application wherein I am downloading some data from server. While

  • 0

I am creating an application wherein I am downloading some data from server. While going in background I want that connection should continue running so that data can be downloaded. I know there is method in appDelegate

- (void)applicationDidEnterBackground:(UIApplication *)application  

which is called when application enters background. But as the connection is created in viewController, how can it be managed in appDelegate?
Also is/are there other way(s) this can be done? I have gone through this link but is there a something simple to implement?

  • 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-06T18:21:58+00:00Added an answer on June 6, 2026 at 6:21 pm

    One way to do some operations that continue in the background is to create a separate thread to do the downloading. Inside the thread, bracket your download operations between calls to beginBackgroundTaskWithExpirationHandler: and endBackgroundTask. You don’t need to check to see whether you are running in the background or not, you just always call these two methods.

    // Tell iOS this as a background task in case we get backgrounded
    UIBackgroundTaskIdentifier taskId = [[UIApplication sharedApplication] 
              beginBackgroundTaskWithExpirationHandler:NULL];
    
    //----------------------------------------------
    // Perform your download operations here
    //----------------------------------------------
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    
    // Tell iOS that we are done with stuff that needed to keep going even if backgrounded    
    [[UIApplication sharedApplication] endBackgroundTask:taskId];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating application that simply reads data from an XML file and displays
I am creating application in facebook using iframe. In that i want to redirect
Im creating an application that gets a list of .java and .class files from
I am creating a chat application wherein I want to use smileys in the
I'm creating a web application wherein users should be able to specify their weekly
i creating an application with movie animation , i have a animation some group
I'm creating an application that allows the user to store information about their classes.
I will be creating an Application that will be showing the Products in a
I am creating an application wherein I need to verify correct email format, for
Im creating an application, wich will conect to several sql database and get some

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.