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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:46:28+00:00 2026-05-12T00:46:28+00:00

Trying to alert user when internet is unavailable (and retry when they dismiss message).

  • 0

Trying to alert user when internet is unavailable (and retry when they dismiss message). The screen slightly dims (in preparation for alert), but the alert never displays.

Is the while loop interfering with the alert?

-(NSArray*)getResponse:(NSString*)page {
NSError *error;
NSURLResponse *response;
NSData *dataReply;
NSString *stringReply;
NSString *legalAddressURL;
NSArray *separatedData;
legalAddressURL = [NSString stringWithFormat:@"%@%@", SERVER, 
                   [page stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: legalAddressURL]];
[request setHTTPMethod: @"GET"];
dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
while ([error code]){
    if (isNetAvailable){
        UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Internet Connection" 
            message:@"Server is down" delegate:self cancelButtonTitle:@"Try again" 
            otherButtonTitles:nil] autorelease];
        [alert show];
        dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    } else {
        UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Internet Connection" 
            message:@"No access to net" delegate:self cancelButtonTitle:@"Try again" 
            otherButtonTitles:nil] autorelease];
        [alert show];
        dataReply = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
    }
}
stringReply = [[NSString alloc] initWithData:dataReply encoding:NSUTF8StringEncoding];
separatedData = [stringReply componentsSeparatedByCharactersInSet:
                 [NSCharacterSet characterSetWithCharactersInString:@","]];
return separatedData;

}

  • 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-12T00:46:28+00:00Added an answer on May 12, 2026 at 12:46 am

    After showing the alert using [alert show], you should exit the getResponse method, because the internal message loop should continue.

    You can’t simply continue looping and showing alerts.

    I could be wrong, but I’m pretty sure that’s the reason.

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

Sidebar

Related Questions

I am trying to echo a javascript alert message in php but I am
I'm trying to display an alert message when a user clicks on one of
I am trying to alert the user when they leave the shopping page with
I'm trying to make an alert show three seconds after the user touches a
I'm trying to alert a message when the browser is resized or scrolled. I'm
I am trying to use the following javascript code to alert the user when
I'm trying to validate text and I use an alert() to let the user
I'm trying to show an alert when a user using IE6 uses my site.
I am trying to add alert for loging user using programming. It is giving
I am trying to alert user for inactivity about 30 secs. So in my

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.