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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:05:04+00:00 2026-06-16T07:05:04+00:00

I’m badly struggling with MBProgressHUD and NSURLconnection… I’m using showWhileExecuting method to call another

  • 0

I’m badly struggling with MBProgressHUD and NSURLconnection…

I’m using showWhileExecuting method to call another private method that has NSURLConnection codes inside.

-(void)HUD
{
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.delegate = self;
    HUD.labelText = @"Initializing";

    [HUD showWhileExecuting:@selector(authenticateWithPhoneNumber) onTarget:self withObject:nil animated:YES];
}

and this is the method I’m calling via showWhileExecuting method.

-(void)authenticateWithPhoneNumber
{
    // Do some stuff
    // Get JSON data using NSURLConnection HERE

    if(successful)
    {   
        //EXC_BAD_ACCESS error here
        [self performSegueWithIdentifier:@"A" sender:self];
    }
    else
    {
        //EXC_BAD_ACCESS error here
        [self performSegueWithIdentifier:@"B" sender:self];
    }
}

When I run the app, I get that EXC_BAD_ACCESS error as well as the following message:

28 0x344c0b8b
29 0x344c082b
30 0xf2d39 -[AuthenticationConfirmationViewController authenticateWithPhoneNumber]
31 0xd9013 -[MBProgressHUD launchExecution]

Assuming that those perform segue codes are the problem… I moved them to inside of the HUD method something like this…

-(void)HUD
{
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.delegate = self;
    HUD.labelText = @"Initializing";

    [HUD showWhileExecuting:@selector(authenticateWithPhoneNumber) onTarget:self withObject:nil animated:YES];

    if(successful)
    {
        [self performSegueWithIdentifier:@"A" sender:self];
    }
    else
    {
        [self performSegueWithIdentifier:@"B" sender:self];
    }
}

Now moving to the next page is fine… EXCEPT that it jumps to one of the pages even before JSON data handling procedure is over.

What’s the problem causing all these troubles?
What’s the right way to approach to the problem in this situation?

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

    Well original method in progress.m has to do something with threading and I am not fun of something I do not completely understand

    #pragma mark - Threading
    
    - (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated {
        methodForExecution = method;
        targetForExecution = MB_RETAIN(target);
        objectForExecution = MB_RETAIN(object); 
        // Launch execution in new thread
        self.taskInProgress = YES;
        [NSThread detachNewThreadSelector:@selector(launchExecution) toTarget:self withObject:nil];
        // Show HUD view
        [self show:animated];
    }
    

    I suggest you to use showHUDAddedTo

        -(void)authenticateWithPhoneNumber
        {
            // Do some stuff
                // Add right before your JSON executions
                MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
                hud.labelText = @"Initializing...";     
            // Get JSON data using NSURLConnection HERE
    
            if(successful)
            {   
                // Add at start of requestFinished AND requestFailed basically remove hud just before your segues
                 [MBProgressHUD hideHUDForView:self.view animated:YES];
                //EXC_BAD_ACCESS error here
                [self performSegueWithIdentifier:@"A" sender:self];
            }
            else
            {
      // Add at start of requestFinished AND requestFailed basically remove hud just before your segues
                 [MBProgressHUD hideHUDForView:self.view animated:YES];
                //EXC_BAD_ACCESS error here
                [self performSegueWithIdentifier:@"B" sender:self];
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I am confused How to use looping for Json response Array in another Array.
I am using JSon response to parse title,date content and thumbnail images and place
I have a small JavaScript validation script that validates inputs based on Regex. I

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.