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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:25:49+00:00 2026-05-19T01:25:49+00:00

I am new to web services. I need to get information from .NET web

  • 0

I am new to web services. I need to get information from .NET web server. For that I am using the following code:

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [webData setLength: 0];

}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [webData appendData:data];
    if (data) {
        NSLog(@" bcxbm,xcm,xcmcmx,b data consist %@",data);
    }
    else {
        NSLog(@"not exist");
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>" delegate:self cancelButtonTitle:@"Retry" otherButtonTitles:@"Cancel", nil];
        [alert show];
        [alert release];
    }

}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{

    NSLog(@"ERROR with theConenction");
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"DONE. Received Bytes: %d", [webData length]);

I am able to get information, but I need to validate it. If there is no connect, I need to fire an Alertview. For that I have the code:

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
    {
        [webData appendData:data];
        if (data) {
            NSLog(@" bcxbm,xcm,xcmcmx,b data consist %@",data);
        }
        else {
            NSLog(@"not exist");
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"<Alert message>" delegate:self cancelButtonTitle:@"Retry" otherButtonTitles:@"Cancel", nil];
            [alert show];
            [alert release];
        }

    }

I check by removing connection. But it does not fire any alerts. After some time, it displays Error in connection in console. But it takes much time. Is there any other possibility than this? How to display alert when there is no connection?

Can anyone please help me?

  • 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-19T01:25:49+00:00Added an answer on May 19, 2026 at 1:25 am

    connection didFailWithError: would be called when connection could not be established. If connection didReceiveData: is being called, it means that you are receiving some kind of data from the web service.

    When you remove the connection, your code tries to connect to the web service and times out after a predefined interval, that is when connection didFailWithError: gets called. It takes time as it tries to connect until the timeout occurs.

    You could check for the internet connectivity before even setting up a connection using Apples’s Reachability example. You can see how to use it from this link

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

Sidebar

Related Questions

I am new to web services in iphone. I need to get data from
I'm receiving data from web-services in XML and I'm using that data via objects,
I am totally new to web services and cannot get mine to work. My
I am new to using web services. I am assigned a task in which
I've got an existing website (based on .net 1.1), that calls web-services (based on
I need to consume a asp.net web service using ColdFusion 8 and return an
I'm using the code snippet below to get user details from a wsdl url
I am new to Java web service and need to be familiar with REST
I am new to WebLogic and J2EE. I need to build a webservice that
I am new to web services and below I am sharing my understanding so

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.