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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:25:23+00:00 2026-06-08T08:25:23+00:00

In my application I need to send request to server to get xml after

  • 0

In my application I need to send request to server to get xml after particular time interval say 1 hour to get the latest data.I want to perform this activity in background.Can anyone suggest how I can achieve this?

Thanks in advance!

  • 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-08T08:25:25+00:00Added an answer on June 8, 2026 at 8:25 am

    To solve above problem I created NSOperation to send request to server and parse response.Its very useful and better than using thread.

    1.I created NSTimer instance which will call -(void)sendRequestToGetData:(NSTimer *)timer after particular time interval as follows:

    //Initialize NSTimer to repeat the process after particular time interval...
        NSTimer *timer = [NSTimer timerWithTimeInterval:60.0 target:self selector:@selector(sendRequestToGetData:) userInfo:nil repeats:YES];
        [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
    

    2.Then inside sendRequestToGetData I created NSOperation by subclassing NSOperation as follows:

    -(void)sendRequestToGetData:(NSTimer *)timer
    {
        //Check whether user is online or not...
        if(!([[Reachability sharedReachability] internetConnectionStatus] == NotReachable))
        {
            NSURL *theURL = [NSURL URLWithString:myurl];
            NSOperationQueue *operationQueue = [NSOperationQueue new];
            DataDownloadOperation *operation = [[DataDownloadOperation alloc] initWithURL:theURL];
             [operationQueue addOperation:operation];
             [operation release];
        }
    }
    

    Note: DataDownloadOperation is subclass of NSOperation.

    //DataDownloadOperation.h
    
    #import <Foundation/Foundation.h>
    
    @interface DataDownloadOperation : NSOperation
    {
        NSURL *targetURL;
    }
    @property(retain) NSURL *targetURL;
    - (id)initWithURL:(NSURL*)url;
    
    @end
    
    //DataDownloadOperation.m
    #import "DataDownloadOperation.h"
    #import "XMLParser.h"
    
    @implementation DataDownloadOperation
    @synthesize targetURL;
    
    - (id)initWithURL:(NSURL*)url
    {
        if (![super init]) return nil;
        self.targetURL = url;
        return self;
    }
    
    - (void)dealloc {
        [targetURL release], targetURL = nil;
        [super dealloc];
    }
    
    - (void)main {
    
        NSData *data = [NSData dataWithContentsOfURL:self.targetURL];
        XMLParser *theXMLParser = [[XMLParser alloc]init];
        NSError *theError = NULL;
        [theXMLParser parseXMLFileWithData:data parseError:&theError];
        NSLog(@"Parse data1111:%@",theXMLParser.mParsedDict);
        [theXMLParser release];
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I send POST request to create some data resource on server. I get Response
i need my application to send an HTTP request to my server, this is
Ok i need to use json on my iOS application to send/receive data to/from
I need to change how my C# application connects to a server to send
All, I'm working on a Flash application that's supposed to send XML data to
I need to build Android application using Java which is able to send request
I need to send a POST request to a web server and be able
I need to make a nodejs client application that can send a POST request
I need to send an HTML report with images from an application. The report
I need to send emails from my web application (on account creation, password reset,

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.