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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:07:15+00:00 2026-05-27T06:07:15+00:00

For some reason in my below code, the replies array is NSLogging the correct

  • 0

For some reason in my below code, the replies array is NSLogging the correct description, but the comment.replies array is NSLogging null.

I immediately presumed that this was due to a memory management issue within my code, but I don’t believe that that is true.

Please can you tell me why this is occurring?

- (TBComment *) dictionaryToComment:(NSDictionary *)dict {
    TBComment *comment = [[TBComment alloc] init];
    [comment setBody:[dict objectForKey:@"body"]];
    [comment setCommentID:[dict objectForKey:@"id"]];
    [comment setCreated_at:[dict objectForKey:@"created_at"]];
    [comment setUpdated_at:[dict objectForKey:@"updated_at"]];
    [comment setUser:[self dictionaryToUser:[dict objectForKey:@"user"]]];
    NSMutableArray *replies = nil;
    if ([[dict allKeys] containsObject:@"replies"]) {
        replies = [[NSMutableArray alloc] init];
        for (NSDictionary *reply in [dict objectForKey:@"replies"]) {
            NSLog(@"in");
            [replies addObject:[self dictionaryToComment:reply]];
        }
    }
    if (replies != nil) {
        [comment setReplies:replies];
        NSLog(@"COMMENT REPLIES = %@", comment.replies);
        NSLog(@"REPLIES = %@", replies);
        [replies release];
    }
    return [comment autorelease];
}

Console ->

2011-11-30 21:25:14.980 Timbrr[2379:f803] in
2011-11-30 21:25:14.980 Timbrr[2379:f803] COMMENT REPLIES = (null)
2011-11-30 21:25:14.980 Timbrr[2379:f803] REPLIES = (
    "<TBComment: 0x68dbeb0>"
)


- (void) setReplies:(NSArray *)_replies {
    hasReplies = (_replies == nil ? NO : ([_replies count] == 0 ? NO : YES));
    //replies is synthesised
}
  • 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-27T06:07:15+00:00Added an answer on May 27, 2026 at 6:07 am

    I would suspect that either comment is nil (though this would require explicit nil-returning code in TBComment, which is possible, but unusual), or that -replies or -setReplies: are incorrectly implemented. Do you have custom implementations for those?

    Your implementation of setReplies: never sets _replies.

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

Sidebar

Related Questions

I have the below code but for some reason I cannot get the correct
The below code works, but for some reason the $('#chart').fadeTo callback seems to create
The below code is in my javascript/jquery script, but for some reason Firebug tells
I've got the code below, but for some reason the Flash slider doesn't allow
I have the below code to open a CSV file, but for some reason
for some reason the below code is outputting the correct ticker in the location
See code below, for some reason it only works when I put a breakpoint
For some reason the code below is returning the results, put not in the
I use the code below to insert data into my sqlite-database but for some
For some reason, the code below fails on the second line with run-time error

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.