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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:53:50+00:00 2026-06-06T06:53:50+00:00

I am trying to figure out this error from previous 3 hours. By searching,

  • 0

I am trying to figure out this error from previous 3 hours. By searching, I have come to know that this error is related to memory management, but I have failed to figure out that what I am doing wrong.

I have declared these 4 labels:

@interface InteractiveHistory : UITableViewController {
UILabel *date;
UILabel *startTime;
UILabel *cal;
UILabel *duration;
}

Then created properties and synthesized them. In viewDidLoad, I initialized all like this one:

date = [[UILabel alloc] init];

I also have deallocated them in dealloc() method.

What I want to do is use these 4 labels to write some text in cells of the table. Text will depend upon the indexPath.

In cellForRowAtIndexPath method, just showing you for 2 labels and have indicated error line:

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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];

        NSLog(@"constructing cell");

        //set up labels text

        date = [NSString stringWithFormat:@"%@",[[int_data objectAtIndex:indexPath.row] objectForKey:@"Date"]];


 NSLog(@"%@",date.text); //App crashes at this line
       [date setTag:1];


        startTime = [NSString stringWithFormat:@"%@",[[int_data objectAtIndex:indexPath.row] objectForKey:@"Start Time"]]; 

        //setting tag and position of label
        [startTime setTag:2];
        CGRect labelpos =  startTime.frame;
        labelpos.origin.y = date.bounds.size.height + 2;
        startTime.frame = labelpos;

        NSLog(@"labels set");

   // Configure the cell...
    [[cell contentView] addSubview:date];
    [[cell contentView] addSubview:startTime];
    [[cell contentView] addSubview:duration];
    [[cell contentView] addSubview:cal];


    NSLog(@"A cell set");

    }      

    return cell;
}

Can anybody plz tell me what am I doing wrong? I hope my Question is clear..

  • 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-06T06:53:53+00:00Added an answer on June 6, 2026 at 6:53 am

    The line:

    date = [NSString stringWithFormat:@"%@",[[int_data objectAtIndex:indexPath.row] objectForKey:@"Date"]];
    

    should be:

    date.text = [NSString stringWithFormat:@"%@",[[int_data objectAtIndex:indexPath.row] objectForKey:@"Date"]];
    

    Otherwise your date pointer is set to an instance of an NSString, instead of setting its contents.

    Edit:

    As danh correctly points out, you will have the same problem with startTime.

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

Sidebar

Related Questions

I have been scratching my head for hours trying to figure out why this
I am trying to figure out this error since 5 hours without any success.
I am trying to figure out why I get this error. My code is
Hello Guys I am trying to figure out why i am gettings this error
I'm trying to figure out why I am getting this error when my Magento
I wrote this code and I am trying to figure out what I have
I am trying to figure out .net and got this code that when I
I'm trying to figure out this error message and I'm not sure what exactly
I am trying to figure out what this compile error means, and I hope
I'm trying to figure out if this is normal. Because without errors, a connection

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.