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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:57:08+00:00 2026-06-13T08:57:08+00:00

I am developing a tabbed application for iOS (5 upwards). My app is experiencing

  • 0

I am developing a tabbed application for iOS (5 upwards).
My app is experiencing crashes in the simulator after a few switches between 2 of the 3 tabs, that both contain tables (and some other – here probably not relevant stuff). following are the important parts of the cell creation and the error code.

The crash happens after a (every time different) number of changes, and always when accessing tab 2.

NOTE i am using ARC.

* UPDATE* The problem only appears on iOS 6. previous versions are not affected.it could be dependent on some threading code that gets called, and looks like this:

if (!self.progressBackground) {
        self.progressBackground = [[UIView alloc]initWithFrame:CGRectMake(100, 260, 120, 120)];
        [self.progressBackground setBackgroundColor:[UIColor blackColor]];
        [[self.progressBackground layer]setCornerRadius:15];
        UILabel *progressText = [[UILabel alloc]initWithFrame:CGRectMake(0, 80, 120, 30)];
        UIFont *fontName = [UIFont fontWithName:@"Helvetica" size:14.0];
        [progressText setFont:fontName];
        [progressText setText:@"Updating Tags"];
        [progressText setTextColor:[UIColor whiteColor]];
        [progressText setTextAlignment:UITextAlignmentCenter];
        [progressText setBackgroundColor:[UIColor clearColor]];
        [self.progressBackground addSubview:progressText];
        [self.progressBackground setAlpha:.6];                   
    }
    if (!self.progressView) {
        self.progressView = [[UIActivityIndicatorView alloc]initWithFrame:self.progressBackground.frame];
        [self.progressView setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
    }
    [self.view addSubview:self.progressBackground];
    [self.view addSubview:self.progressView];
    [self.progressView  startAnimating];

    [NSThread detachNewThreadSelector:@selector(initializeCategoriesArray) toTarget:self withObject:nil]; 

and the method ‘initializeCategoriesArray’ looks like that:

-(void)initializeCategoriesArray{

if (!self.categoryArchive) {
    self.categoryArchive = [[NSMutableArray alloc]init];
} 

//set the right month' expenses
self.currentMonthExpenses = (NSMutableArray*)[self.dataHandler fetchAllExpensesForMonth:[NSNumber numberWithInteger:self.currentMonthNumber ]];


// check if expenses exist at all

if (self.currentMonthExpenses.count == 0) {
    [self.categoryArchive removeAllObjects];
    [self.categoriesTable reloadData];
    [self.progressView performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:YES];
    [self.progressView performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
    [self.progressBackground performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
    return;
}



// sort out month Expenses
NSMutableArray *dayTypeExpenses = [[NSMutableArray alloc]init];
for (Expense *exp in self.currentMonthExpenses) {
    if (exp.expenseType.boolValue == NO) {
        [dayTypeExpenses addObject:exp];
    }
}


// check if dayExpenses exist
if (dayTypeExpenses.count == 0) {
    [self.categoryArchive removeAllObjects];
    [self.categoriesTable reloadData];
    [self.progressView performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:YES];
    [self.progressView performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
    [self.progressBackground performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
    return;
}

// create Dictionary holding all DayExpenses under their STRING AS KEY
NSMutableDictionary *tempDict = [[NSMutableDictionary alloc]init];
for (Expense *exp in dayTypeExpenses) {

    NSMutableArray *temp = [tempDict objectForKey:exp.name];
    if (temp == nil) {
        NSMutableArray *tempArray = [[NSMutableArray alloc]init];
        [tempDict setValue:tempArray forKey:exp.name];
    }
    [[tempDict objectForKey:exp.name]addObject:exp];
}

// create temporary (unsorted) array of Categories
NSMutableArray *tempCatArray = [[NSMutableArray alloc]init];
for (NSMutableArray *expArray in [tempDict allValues]) {
    double totValue = 0;
    NSInteger count = 0;
    double average = 0;
    CGFloat percentage = 0;
    for (Expense* exp in expArray) {
        count++;
        totValue = totValue+exp.value.doubleValue;
    }
    average = totValue/count;
    percentage = totValue/self.spentCurrentMonth;
    Category *newCategory = [[Category alloc]init];
    [newCategory setTotalValue:totValue];
    [newCategory setName:[[expArray objectAtIndex:0]name]];
    [newCategory setNumberOfExpenses:count];
    [newCategory setAverageValue:average];
    [newCategory setPercentOfBudgetInFloat:fabs(percentage)];

    [tempCatArray addObject:newCategory];
}

// sort tempArray
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc]initWithKey:@"totalValue" ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObjects:sortDescriptor, nil];
self.categoryArchive = [[tempCatArray sortedArrayUsingDescriptors:sortDescriptors]mutableCopy];

// find normfactor


CGFloat normFactor = fabs(1.0/[[self.categoryArchive objectAtIndex:0] percentOfBudgetInFloat]);

for (Category *cat in self.categoryArchive) {
    if (cat.name.length == 0) {
        cat.name = @"Uncategorized";
    }
    if (cat.percentOfBudgetInFloat >= 1) {
        cat.percentOfBudgetInFloat = 1;
    }
    cat.percentOfBudgetInFloat = cat.percentOfBudgetInFloat*normFactor;
}


// reload
[self.categoriesTable reloadData];

[self.progressView performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:YES];
[self.progressView performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];
[self.progressBackground performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:YES];

}

Tab 1:

TableView, each cell contains 2 labels 1 button

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"dayCell";    
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    UIFont *subjectFont = [UIFont fontWithName:@"Helvetica" size:14.0];
    UIFont *valueFont = [UIFont fontWithName:@"Helvetica-Bold" size:14.0];

    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    [cell.textLabel removeFromSuperview];


    // Cell Look
    UIImageView *backgroundImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"cell" ]];
    [cell setBackgroundView:backgroundImg];

    // Subjectlabel
    UILabel *subjectLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 15, 160, 20)];
    //...

    // ValueLabel
    UILabel *valueLabel = [[UILabel alloc]initWithFrame:CGRectMake(160, 15, 90, 20)];
    //...


    // Deletion Button
    UIButton *delButton = [[UIButton alloc]initWithFrame:CGRectMake(255, 0, 50, 50)];
    [delButton setBackgroundColor:[UIColor clearColor]];
    [delButton setImage:[UIImage imageNamed:@"delButt" ] forState:UIControlStateNormal ];
    delButton.tag = 1002;
    [cell addSubview:delButton];
}
//...

UIButton *delButton = (UIButton*)[cell viewWithTag:1002];
[delButton addTarget:self action:@selector(deleteRow:) forControlEvents:UIControlEventTouchUpInside];

//...
return cell;
}

Tab 2:

TableView, each cell contains 2 labels, 1 rectangular UIView

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"thisMonthCell";


UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    UIFont *subjectFont = [UIFont fontWithName:@"Helvetica" size:14.0];
    UIFont *valueFont = [UIFont fontWithName:@"Helvetica-Bold" size:16.0];

    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    [cell.textLabel removeFromSuperview];

    // BarGraph for this Cell
    UIView *barProgress = [[UIView alloc]initWithFrame:CGRectMake(20, 1, 1, 37)];
    [barProgress setBackgroundColor:[self goldBarColor]];
    [barProgress setAlpha:.5];
    barProgress.tag = 1000;
    [cell addSubview:barProgress];



}

Category *cellCategory = [self.categoryArchive objectAtIndex:indexPath.row];

UIView *progressBar = (UIView *)[cell viewWithTag:1000];
[progressBar setFrame:CGRectMake(progressBar.frame.origin.x, progressBar.frame.origin.y, cellCategory.percentOfBudgetInFloat*280, progressBar.frame.size.height)];

//...


return cell;

}

The errorcode upon crashing reads like this:

2012-10-18 14:57:13.218 DailyBudget[4714:c07] * -[UITableViewCellAccessibilityElement release]: message sent to deallocated instance 0x7571630
dlopen(/Applications/Xcode.app/Contents/PlugIns/DebuggerFoundation.ideplugin/Contents/Resources/DebuggerIntrospectionSupport.dylib, 0x00000002)
dyld: loaded: /Applications/Xcode.app/Contents/PlugIns/DebuggerFoundation.ideplugin/Contents/Resources/DebuggerIntrospectionSupport.dylib


The problem appears only in the simulator, not on a real device (both iOS 6.0)

Any ideas what the issue might be?

  • 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-13T08:57:09+00:00Added an answer on June 13, 2026 at 8:57 am

    EDIT:

    Actual problem was updating UI off of the main thread. Read comments for details.

    — Original Answer —

    I would suggest you use a custom cell, instead of trying to programmatically alter a built in Apple tableviewcell. The docs have some good examples on how to do this. If you have a storyboard it is really easy.

    My guess would be something is happening with expected retain counts in the tableview cell’s objects (the textlabel — accessory view connection) that you’ve messed with, and arc isn’t catching your removeFromSuperview magic.

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

Sidebar

Related Questions

Developing an HTML 5 application on new iPad's Mobile Safari iOS 5 that displays
Developing a web application that I've registered with Twitter. In this app, I might
Iam developing one application.In that iam placing the radio buttons(uiimageview) on table view and
iam developing one application.In that i need to get the music files from the
Developing a network application, I have a Connection class that manages sending and receiving
Developing an application for Android, i want to record data that will be usefull
Developing an Android App integrated with Facebook. After registering my app on Facebook, getting
i am developing a java swing application that doesn't fit the normal application profile.
I am developing an android application and have created a tabbed layout for my
Developing an app for iOS, I need to know how to have instanced and

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.