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

  • Home
  • SEARCH
  • 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 6045193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:05:51+00:00 2026-05-23T07:05:51+00:00

another objective c question for you. Probably a simple one too… In my viewDidLoad

  • 0

another objective c question for you. Probably a simple one too…

In my viewDidLoad method I am setting a variable. I need to access this within - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath however I am receivig the following error and I don’t really know a way to sort it!

-[CFString intValue]: message sent to deallocated instance 0x592dcb0

- (void)viewDidLoad
{   
    //code to get json is here
    totalInCategory = [parsedJson objectForKey:@"TotalInCategory"];
    NSLog(@"totalincat %i",[totalInCategory intValue]);

    [super viewDidLoad];
}

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)celllforRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"totalincat %i",[totalInCategory intValue]);

    if((indexPath.row == [myArray count]-1)&&(indexPath.row < [totalInCategory intValue]))
    {
        //code to get more rows
        [self.tableView reloadData];
    }
}

I have NSString *totalInCategory; set up and synthesized.

totalInCategory is fine within viewDidLoad (as far as I’m aware that is), but nowhere else… any ideas would be really handy!

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

    Retain the data…

    totalInCategory = [[parsedJson objectForKey:@"TotalInCategory"] retain];
    

    objectForKey returns an autoreleased object which you need to retain if you wish to use it. Don’t forget to add a [totalInCategory release]; in the dealloc.

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

Sidebar

Related Questions

This is probably a common Objective-C question reported by Java coders, but I don't
Another easy one hopefully. Let's say I have a collection like this: List<DateTime> allDates;
In another question on SO I answered with code like the one below and
Another question of mine about optimizing Objective C programs inspired the following: does anyone
I responded to another question about developing for the iPhone in non-Objective-C languages, and
Ok, I know the answer for this question may not be objective but I
How can I call an Objective-C method from another class? For instance in xCode
Let’s take this string has an example: D:/firstdir/Another One/and 2/bla bla bla/media/reports/Darth_Vader_Report.pdf I want
My objective is to write a program which will call another executable on a
Another poster asked about preferred syntax for infinite loops . A follow-up question: Why

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.