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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:12:23+00:00 2026-06-04T16:12:23+00:00

I am developing an app using parse.com API (hosted backend which provides API to

  • 0

I am developing an app using parse.com API (hosted backend which provides API to save data on their servers). I want to be able to use the app seamlessly online and offline.
For this I would need to use a queue where I can place blocks that require network access. When network does become available, the blocks should be executed serially and when the network goes offline, then the queue processing should be suspended.

I was thinking of using GCD with suspend/resume as the network becomes available/unavailable.
I was wondering if there are any better options? Will this work if the app is put in the background? Case in point here is that a user saves some data when the network is unavailable (which gets queued) and then puts the app in the background. Now when the network becomes available, is it possible to do the saving in the background automagically?

  • 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-04T16:12:25+00:00Added an answer on June 4, 2026 at 4:12 pm

    I do exactly what you’re aiming for using an NSOperationQueue. First, create a serial queue and suspend it by default:

    self.operationQueue = [[[NSOperationQueue alloc] init] autorelease];
    self.operationQueue.maxConcurrentOperationCount = 1;
    [self.operationQueue setSuspended:YES];
    

    Then, create a Reachability instance and register for the kReachabilityChangedNotification:

    [[NSNotificationCenter defaultCenter] addObserver:manager
                                             selector:@selector(handleNetworkChange:) 
                                                 name:kReachabilityChangedNotification 
                                               object:nil];
    
    [self setReachability:[Reachability reachabilityWithHostName:@"your.host.com"]];
    [self.reachability startNotifier];
    

    Now, start and stop your queue when the network status changes:

    -(void)handleNetworkChange:(NSNotification *)sender {
        NetworkStatus remoteHostStatus = [self.reachability currentReachabilityStatus];
    
        if (remoteHostStatus == NotReachable) {
            [self.operationQueue setSuspended:YES];
        }
        else {
            [self.operationQueue setSuspended:NO];
        }
    }
    

    You can queue your blocks with:

    [self.operationQueue addOperationWithBlock:^{
        // do something requiring network access
    }]; 
    

    Suspending a queue will only prevent operations from starting–it won’t suspend an operation in progress. There’s always a chance that you could lose network while an operation is executing, so you should account for that in your operation.

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

Sidebar

Related Questions

I am developing an app using data from google reader's API and using GData
I've any problems for app I'm developing... I'm using Core Data and I just
I am developing app using facebook API. When I push 'login' button from my
I am developing an app using WF hosted in IIS as WCF services as
We're developing an app (using Grails Spring Security (formerly Acegi)) in which we'll have
I am developing web app using asp.net. I have plenty of javascript files which
I am developing an app using jquery mobile.. In that i want to show
I am developing an app using phonegap for Android. I want this mobile application
I am developing an app using android OS for which I need to know
I am developing an app using jqm+phonegap. I want to store the selected options

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.