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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:03:37+00:00 2026-05-24T21:03:37+00:00

In my application, i have a button wich calls an ASIHTTPRequest. The request goes

  • 0

In my application, i have a button wich calls an ASIHTTPRequest. The request goes fine and i receive an response string. But when the request finishes, it always goes to the method: requestFinished. And i also got a requestFailed method. But even when i give a wrong link, the request finsihes and never fails.. Why is this? This is my code:

-(void)fetchForm:(id)sender {

    NSURL *URL=[NSURL URLWithString:@"http://www.mydomain.nl/testGet.php"]; 
    ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:URL] autorelease];
    [request setDelegate:self];
    [request setDidFailSelector:@selector(requestFailed:)];
    [request startAsynchronous];

}

-(void)requestFinished:(ASIHTTPRequest *)request {
    NSLog(@"Request Success!");
}

-(void)requestFailed:(ASIHTTPRequest *)request {
    NSLog(@"Request Failed!");
}

EDIT:

I read a little documentation on the ASIHTTPRequest website. And i came to the conclusion that i need to see for myself if there is an error code. i do this with:

int statusCode = [request responseStatusCode];

if (statusCode == 404) {
NSLog(@"Statuscode 404 has occured!");
}
  • 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-24T21:03:39+00:00Added an answer on May 24, 2026 at 9:03 pm

    There are several conditions that might affect error reporting with HTTP requests. From ASIHTTP’s viewpoint, if the request object can be successfully built, sent, and a some kind of response is received, then everything is ok.

    In my case, for example, my ISP has a proxy that will return an error page with many not existing URLs and sometimes even with ill-formed URLs. In such cases, ASIHTTP will not fail. I don’t know if this is also your case, but it was for me.

    If you look at the file ASIHTTPRequest.m and search for failWithError, you will see all the cases where ASIHTTP will trigger the mechanism that leads to the didFailSelector to be called. You might even set a breakpoint in the failWithError method to see if it is called.

    EDIT:

    In a sense ASIHTTPRequest mechanism is very basic and covers failures at the network level. If you receive a response then it is an application level failure and you have to deal with it.

    First thing is checking the HTTP status code:

    int statusCode = [request responseStatusCode];
    NSString *statusMessage = [request responseStatusMessage];
    

    This will allow you to identify 404, 500, and so on.

    If this does not work and the server does not send an error code, then the only way to go about it is parsing the response you receive and, if it does not contain the data you were waiting for, fail.

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

Sidebar

Related Questions

I have a button on an ASP.NET wep application form and when clicked goes
I have this code in the end of link button click: Response.ContentType = application/zip;
in my web application I have a button when I click I want to
I am using mpmovieplayer in my application.I have a button for playing movie witch
I have a button in my application which is bound to a command. This
My application is viewbased application in which I have one button. On click of
In my hello world application, i have a button and a text field set
As suggested by Apple, I have put a button on my application, to restore
I use yui datatable in my asp.net application... I have a link button in
I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is

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.