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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:28:16+00:00 2026-05-18T20:28:16+00:00

I am using the MBProgressHUB, with variations on the code found here . Some

  • 0

I am using the MBProgressHUB, with variations on the code found here.

Some things about my code:

  • The code is in my App Delegate
  • A number of other classes call it
  • I’m using it with asynchronous NSURLConnection
  • I do not declare it: @property (nonatomic, retain) MBProgressHUD *HUD;
  • I do not: @synthesize HUD;
  • (and of course I do not release it in my dealloc)

I use it as follows:

- (void)setSearchingMode:(BOOL)isSearching {
    // when network action, toggle network indicator and activity indicator
    if (isSearching) {
        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
        
        UIWindow *theWindow = [UIApplication sharedApplication].keyWindow;
        HUD = [[MBProgressHUD alloc] initWithWindow:theWindow];
        [theWindow addSubview:HUD];
        
        //HUD.labelText = @"Connecting";
        [HUD show:YES];
    } else {
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
        
        [HUD hide:YES];
        [HUD removeFromSuperview];
        [HUD release];
    }
}

- (void)setSearchingText:(NSString *)whatToSay {
    HUD.labelText = whatToSay;
}

I am fairly sure that the code is causing a memory management problem somewhere. In my crash log, I get:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000c

0 libobjc.A.dylib 0x000027d8 objc_msgSend + 16
1 My 0x00003120 -[MyAppDelegate setSearchingMode:] (MyAppDelegate.m:363)
2 My 0x00003458 -[MyAppDelegate connectionDidFinishLoading:] (MyAppDelegate.m:341)
3 Foundation 0x00032896 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 62
4 Foundation 0x00032818 _NSURLConnectionDidFinishLoading + 72

in connectionDidFinishLoading I call:

[self setSearchingMode:NO];

I tried to do it by making property accessors for HUD, but was not able to get around the line "[MBProgressHUD alloc] initWithWindow" – and I don’t want to keep on alloc’ing an ivar!

Thanks, if anyone can point me in a better direction here..

  • 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-18T20:28:17+00:00Added an answer on May 18, 2026 at 8:28 pm

    If you happen to end up with the sequence of:

    [self setSearchingMode:YES];
    [self setSearchingMode:NO];
    [self setSearchingMode:NO];
    

    That code will crash as described because of the dangling reference to HUD. When you do [HUD release];, add HUD = nil; after that line.

    It isn’t a memory leak; it is an over-release. Or, more likely, a dangling reference.

    (and of course I do not release it in
    my dealloc)

    Why not? If you retain it, you better release it!

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

Sidebar

Related Questions

I am using the MBProgressHUB, with variations on the code found here . Some
I'm using MBProgressHud to show a load indicator. Here is my display code: self.hud
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I'm using MBProgressHUD to show spinner while loading some web pages. for some sites,
I have an tabbed App using UITabBarController . There are 2 tabs, linked to
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
I'm using MBProgressHUD in our teaching App, which is tab bar navigated. The user
So I am using NSURLConnection delegate to download a JSON feed in my AppDelegate.m
Using this code, the following execution yields strange results: C 100 R W The

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.