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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:44:05+00:00 2026-05-26T03:44:05+00:00

My app is crashing when i scroll my TableView. First in my viewDidLoad method

  • 0

My app is crashing when i scroll my TableView. First in my viewDidLoad method a load a dictionary from a file and for this dictionary i enumerate all keys.

 - (void)viewDidLoad {

     [super viewDidLoad];

     NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)objectAtIndex:0];      

     path = [rootPath stringByAppendingPathComponent:[NSString stringWithFormat:@"currency.archive"]]; 

     banks = [NSKeyedUnarchiver unarchiveObjectWithFile:path];

     keys = [banks allKeys];

     // set date for last update 
     dayMonthYear.text = [banks objectForKey:@"Last Updated"];
}

In my cellForRowAtIndexPath i populate cells with data from that dictionary. Anyway when my app starts everything looks fine, first five rows are drawn correctly, but when i start to scroll my app crash. My idea is that the problem is with autoreleased object here, i tried to retain them and after using them to release ,but unsuccessful. DEBUGGER SHOWS THAT MY PROBLEM IS AT LINE WITH BOLD

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    NSString *CellIdentifier = [NSString stringWithFormat:@"Cell %d_%d",indexPath.section,indexPath.row];

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {      

        [[NSBundle mainBundle] loadNibNamed:@"CurrencyTableCell" owner:self options:nil];

        cell = currencyTableCell;

        //don't show selected cell
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        //set height
        self.cellHeight = cell.frame.size.height;
    }    

    // Fetch currency 
    NSString *currentCurrency = [keys objectAtIndex:indexPath.row];

    NSDictionary *fetchedCurrency = [banks objectForKey:currentCurrency];

    **NSString *name = [fetchedCurrency objectForKey:@"Currency Name"];**

    currencyTitle.text = name;

    NSString *charCode = [fetchedCurrency objectForKey:@"Code"];

    currencyCode.text = charCode;

    NSString* formattedNumber = [NSString stringWithFormat:@"%.02f",[[fetchedCurrency  objectForKey:@"Value"] floatValue]];

    if ([formattedNumber length] == 4) {
        formattedNumber = [NSString stringWithFormat:@"%@%@",@"0",formattedNumber];
    }

    buyPrice.text = formattedNumber;

    return cell;    
}
  • 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-26T03:44:05+00:00Added an answer on May 26, 2026 at 3:44 am

    As a result from the discussion, [banks objectForKey:@"Last Updated"] gives you a NSString, not a NSDictionary!

    You could get around this error by doing

    if ([[banks objectForKey:currentCurrency] class] == [NSDictionary class]) { 
        ... rest of the code here .. 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app uses a WebRequest at certain points to get pages from itself. This
My app needs to build a buffer from all the selected cells on a
I have been trying to fix this problem for hours. My app keeps crashing
I'm having some issues with an iPhone app crashing when it comes from background,
My app is crashing on 3.1.3 because of this NSConcreteBlock error. I read the
My App is crashing when I start this activity. I have an edit text
My Android app is crashing with this error: E/AndroidRuntime( 315): Caused by: android.database.sqlite.SQLiteException: bind
While adding Nsdate values to NSmutablearray my app gets crashing. - (void)viewDidLoad { markarry=[[NSMutableArray
In an iPhone app I currently have code for downloading a file from the
I have this problem of my app crashing (only when press a certain UIButton)

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.