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

  • Home
  • SEARCH
  • 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 6106559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:05:33+00:00 2026-05-23T14:05:33+00:00

I’ve been struggling with this problem for over a week. And I really need

  • 0

I’ve been struggling with this problem for over a week. And I really need some help.

I am using ASIHTTPRequest to handle three different download requests. The first download request will download from an online .txt file a timestamp. According to that timestamp, it must process how the application will launch.

It will check if a timestamp has been previously saved in NSUserDefaults, if not then this is the first time the app is launched and it will download a JSON feed (using ASIHTTPRequest) and then parse it into Core Data.

If the stored timestamp matches the online one, then nothing happens since the data is up to date.

If the stored timestmap is older than the online timestamp, then the database will be cleared and redownloaded.

My problem is that in ASIHTTPRequest, before requestFinished gets executed, application:didFinishLaunchingWithOptions gets executed to the end. Now in the beginning of application:didFinishLaunchingWithOptions, I ask ASIHTTPRequest to download the online timestamp. Before application:didFinishLaunchingWithOptions is over, I need to have the online timestamp downloaded and ready to be use. How would I do that? Problem with ASIHTTPRequest is that it starts executing after application:DidFinishLaunchingWithOptions is over.

  • 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-05-23T14:05:33+00:00Added an answer on May 23, 2026 at 2:05 pm

    Without some code to look at, our answers have to be fairly general. But it sounds to me like you need to change your startup flow completely.

    If it’s important that your http requests happen in order, you need to call them in order–nested in each other’s completion delegate methods. You can use ASIHTTPRequest’s .userInfo field to identify the different types of request you’re firing.

    Your didFinishLaunching method should just do enough to get your first request started (and maybe bring up a “loading” view), then the rest of the app launching work needs to be done in the various requestDidFinish methods.

    If you’re in control of the website side of things too, you might see how much of this work you can offload to the server code. I prefer to do my work on the biggest iron I can find, which means I usually do my data manipulation in my web app, and just send the results out to the phone.

    EDIT: Here’s some code to describe what I mean by “nested in each other’s completion methods”. Note that I just typed this right here, so don’t just copy and paste this and expect anything like sensible behavior.

    // inside didFinishLaunching
    ASIHTTPRequest *myInitialRequest = [ASIHTTPRequest requestWithURL:myNSURL];
    myInitialRequest.userInfo = [NSDictionary dictionaryWithObject:@"initial" forKey:@"type"];
    myInitialRequest.delegate = self;
    [myInitialRequest startAsynchronous];
    // and then NOT other setup stuff that depends on this data.
    
    
    -requestDidFinish:(ASIHTTPRequest *)request
    {
        if ([[request.userInfo objectForKey:@"type"] isEqualToString:@"initial"]) {
            //you just used the userinfo field to differentiate this from other requests
            //do whatever here, and then make your next request HERE.
    
            ASIHTTPRequest *nextRequest = [ASIHTTPRequest requestWithURL:myNextURL];
            nextRequest.delegate = self;
            nextRequest.userInfo = [NSDictionary dictionaryWithObject:@"next" forKey:@"type"];
            [nextRequest startAsynchronous];
        }
        if ([[request.userInfo objectForKey:@"type"] isEqualToString:@"next"]) {
            // so now you know this is your "next" type request coming back to you.
    
            // ... so do whatever you do with this, and then HERE do the rest of your
            // app setup and launch business.
        }
    }
    

    So you set up a request with a userInfo field that identifies it, and then differentiate the handling of its response based on that field. That’s basic to using more than one ASIHTTPRequest in a view controller anyway.

    And then your next request is based on the response of the first one–you’re launching a second request after learning what you needed to learn from the first one’s response content.

    By the way, you can also specify the completion handler method, or use the block interface to specify what ASIHTTPRequest does on completion. But I think loading your requests up with identifying userInfo fields and then handling your responses all in one place is the cleanest approach.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.