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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:10:51+00:00 2026-06-14T07:10:51+00:00

I am using performSelector to call URLRequest every couple of second with different timetstamp.

  • 0

I am using performSelector to call URLRequest every couple of second with different timetstamp. However, data processing may take longer than the time I have defined.

  [self performSelector:@selector(process) withObject:nil afterDelay:1.6];

below part shows the method is called

 -(void)process
{
    timestamp=[NSString stringWithFormat:@"%1.f",progressValue];
    NSString *contour=@"&bandschema=4";
    NSString *url6=[NSString stringWithFormat:@"http://contour.php?  callback=contourData%@&type=json&timestamp=%@%@",timestamp,timestamp,contour];        
    NSURL *url1=[NSURL URLWithString:url6];
  __weak ASIHTTPRequest *request1 = [ASIHTTPRequest requestWithURL:url1];
        [request1 setCompletionBlock:^{
            responseString = [request1 responseString];
                [self plotPoint:self.responseString];

        }];
        [request1 setFailedBlock:^{

            NSError *error=[request1 error];
            NSLog(@"Error: %@", error.localizedDescription);
        }];
        [request1 startAsynchronous];
    }

this part is start point of analyzing data.

-(void)plotPoint:(NSString *)request
{
    NSArray *polygonArray = [[dict  objectForKey:@"data"]valueForKey:@"polygon"];
    NSArray *valleyPolygonArray = [[dict objectForKey:@"valley"]valueForKey:@"polygon"];
    CLLocationCoordinate2D *coords;
}

However sometimes time interval is not enough to get new data especially when internet connection is not good.

Could you guide me please? How could I handle the problem? What is the optimal solution?

  • 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-14T07:10:52+00:00Added an answer on June 14, 2026 at 7:10 am

    Why dont you call process after you get the response as follows,

    -(void)process
    {
        timestamp=[NSString stringWithFormat:@"%1.f",progressValue];
        NSString *contour=@"&bandschema=4";
        NSString *url6=[NSString stringWithFormat:@"http://contour.php?  callback=contourData%@&type=json&timestamp=%@%@",timestamp,timestamp,contour];        
        NSURL *url1=[NSURL URLWithString:url6];
      __weak ASIHTTPRequest *request1 = [ASIHTTPRequest requestWithURL:url1];
            [request1 setCompletionBlock:^{
                responseString = [request1 responseString];
                [self plotPoint:self.responseString];
    
                if (somecondition)//based on some condition to break the chain when needed
                  [self process];    
            }];
            [request1 setFailedBlock:^{
    
                NSError *error=[request1 error];
                NSLog(@"Error: %@", error.localizedDescription);
    
                if (somecondition)//based on some condition to break the chain when needed
                  [self process];        
            }];
            [request1 startAsynchronous];
        }
    

    This way you can keep 1.6 as the exact time interval after getting a response to creating a new request.

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

Sidebar

Related Questions

I'm using this call to switch image every 4 seconds: - (void) settheimage {
Using import datetime in python, is it possible to take a formatted time/date string
My problem is, at some point in my application I call [performSelector: withObject: afterDelay:]
I'm using UISearchResultsController to filter data from a fetchedResultsController . Here is the relevant
I'm using selectors to dynamically call functions in Objective-C. My problem is that my
I start a repeating NSTimer after a 4 second delay using the following code:
I want to pass an NSInteger argument to a method called using performSelector:WithObject:afterDelay, so
I am using NSOperationQueue and NSOperation to perform requests to twitter. However when I
Is there a way to call [anObject performSelector]; with more than 2 objects? I
I am using the following code, but even after I call it, my app

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.